Does anyone know how to create sockjs-node (SockJS - WebSocket emulation) or Shoe standalone server?
Is it possible to crate without http Server?
Just need to exchange data with dnode
, and static pages are not necessary.
For instance, when I do on node server side:
var shoe = require('shoe');
var dnode = require('dnode');
var http = require('http');
var server = http
.createServer()
.listen(9999);
var echo = shoe
.createServer()
.on('connection', function(c)
{
var d = dnode(
{
test: function()
{
console.log('--------');
}
});
c
.on('data', function(message)
{
c.write(message);
})
.on('close', function() {});
c
.pipe(d)
.pipe(c);
c.on('close', function() {});
})
.installHandlers(server,
{
prefix: '/dnode'
});
The following code(Client Side)
var d = dnode()
.on('remote', function(remote)
{
remote.test();
});
d
.pipe(shoe('http://localhost/dnode'))
.pipe(d);
Fails with the following error:(Chrome)
GET http://localhost/dnode/info app.bundle.js:14681
AbstractXHRObject._start app.bundle.js:14681
(anonymous function)
Could not find a way with SockJS or Shoe, so I switched with websocket-stream.
Here's a working code:
node server
browser client