how to use socketio-transport
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
node_modules
public
.gitignore
Makefile
README.md
server.js

README.md

#socketio-transport example

start server:

node server.js

open index.html:

open public/index.html

##Server side configuration

var socketioTransport = require("socketio-transport").Server;
var io = require('socket.io').listen(8000);
var Store = require("observable-store");

socketioTransport(io, new Store({
    test: function (payload, onEnd, onData) {
        setInterval(function () {
            onData((new Date));
        }, 200);
    },

    // other handlers here .....
}));

##Client side

var SocketioTransport = require("socketio-transport").Client;
var socket = io.connect('http://localhost:8000');

var socketioTransport = new SocketioTransport(socket);

socketioTransport.listen("test", {}, function () {
    console.log(arguments);
}, function () {
    console.log(arguments);
});

See that a channel is open on test and publishes dates every 200ms in the console.

#LICENSE

MIT