Socket
Socket
Sign inDemoInstall

engine.io-stream

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

engine.io-stream

Make engine.io a valid node stream


Version published
Maintainers
2
Created
Source

engine.io-stream

simple interface to engine.io via node streams

The API is pretty much the same as shoe

Example Client

var engine = require("engine.io-stream")

// attach to an engine.io server at url '/numbers'
var stream = engine("/numbers")

stream.on('data', function(data) {
    console.log(data)
    stream.write('ack')
})

Example Server

var http = require("http")
var EngineServer = require("engine.io-stream")

// engines need to attach to server instances (see below)
var server = http.createServer(...)

var engine = EngineServer(function(stream) {
    // send back some numbers, you know...for fun
    var iv = setInterval(function () {
        stream.write(String(Math.floor(Math.random() * 2)))
    }, 250)

    stream.once("end", function () {
        clearInterval(iv)
    })

    stream.pipe(process.stdout, { end : false })
})

// expose the engine instance at this url
engine.attach(server, "/numbers")

server.listen(8080, function() {
    console.log("Listening on port 8080")
})

Installation

npm install engine.io-stream

Contributors

  • Raynos
  • shtylman
  • juliangruber
  • hij1nx

Licence

MIT

FAQs

Package last updated on 13 Jan 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc