Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Wrap engine.io in a real stream interface
JavaScript Makefile HTML
branch: master
Failed to load latest commit information.
examples fix simple example
test add local testing via zuul
.gitignore first
.travis.yml add saucekeys to travis.yml for cloud testing
.zuul.yml
LICENCE first
README.md Update README.md
client.js syntax cleanup
eiostream.js forward destroy
package.json
server.js exposes the real engine.io server from the attach method (as it does …

README.md

engine.io-stream

build status NPM version Davis Dependency status

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/client")

// 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

Something went wrong with that request. Please try again.