Getting started with real time - XSockets/XSockets.NET-4.0 GitHub Wiki
##Getting started with real-time ###1. Start a server
using XSockets.Core.Common.Socket;
using XSockets.Plugin.Framework;
using (var container = Composable.GetExport<IXSocketServerContainer>())
{
container.Start();
Console.ReadLine();
}
###2. Create a client and listen for "MyMessage"
JavaScript
var conn = new XSockets.WebSocket('ws://127.0.0.1',['generic']);
conn.controller('generic').mymessage = function(data){
alert(data.Text);
};
C#
var conn = new XSocketClient("ws://127.0.0.1:4502", "http://localhost","generic");
conn.Open();
conn.Controller("generic").On<dynamic>("mymessage", data => Console.WriteLine(data.Text));
JavaScript
conn.controller('generic').invoke('mymessage',{Text:'Hello JS RealTime'});
C#
conn.Controller("generic").Invoke("mymessage",new {Text = "Hello C# RealTime"});
For code samples and video tutorials see our Virtual Academy
Learn to...
- Use Pub/Sub, RPC or both!
Create...
- Powerful server-side controllers
- Custom pipeline
- Interceptors (for messages, connections and errors)
- Protocol-plugins (for connecting other things, devices, languages)
- Clients in .NET, NodeJS, C, Perl, Raw sockets or whatever you feel like connecting!