engine.io-stream
Make engine.io a valid node stream
Last updated 11 years ago by raynos .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install engine.io-stream 
SYNC missed versions from official npm registry.

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

Current Tags

  • 0.4.3                                ...           latest (11 years ago)

10 Versions

  • 0.4.3                                ...           11 years ago
  • 0.4.2                                ...           11 years ago
  • 0.4.1                                ...           11 years ago
  • 0.4.0                                ...           11 years ago
  • 0.3.2                                ...           11 years ago
  • 0.3.1                                ...           11 years ago
  • 0.3.0                                ...           11 years ago
  • 0.2.1                                ...           12 years ago
  • 0.2.0                                ...           12 years ago
  • 0.1.0                                ...           12 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (2)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |