0.0.6 • Published 9 years ago

xsockets.net v0.0.6

Weekly downloads
25
License
-
Repository
-
Last release
9 years ago

XSockets.NET 4 nodejs

A basic client for full duplex communication between XSockets.NET and NodeJS

var xsockets = require('./xsockets.net');

var c = new xsockets.TcpClient('127.0.0.1', 4502, ['animal']);
c.controller('animal').on('cat', function(d) {
	console.log('cat',d.says);
});


c.controller('animal').onopen = function(ci) {
	console.log('connected controller animal');    
	c.controller('animal').send('cat', {says:'mjau'});
}

c.onconnected = function(d) {
	console.log('connected', d);
}
c.open();

To test without writing C# in XSockets you can replace 'animal' with 'generic'. If you want to add a XSockets controller in the server just add the class below.

public class Animal : XSocketController
{
    public override async Task OnMessage(IMessage message)
    {
        await this.InvokeToAll(message);
    }
}
0.0.6

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago