I tweak XSockets.Net Server now.
I read http://xsockets.net/docs/c-server-api#using_events
Using events
The server side API offer a few events to help you out.
OnOpen
Invoked when the client is connected and the handshake is completed.
//Hook up the event in the constructor.
public MyController()
{
this.OnOpen += MyController_OnOpen;
}
void MyController_OnOpen(object sender, OnClientConnectArgs e)
{
//The connection is open...
}
so, if I do the below in VisualStduio.net
class MyController : XSocketController
{
//Hook up the event in the constructor.
public MyController()
{
this.OnOpen += MyController_OnOpen;
}
void MyController_OnOpen(object sender, OnClientConnectArgs e)
{
//The connection is open...
}
}
MyController_OnOpen
and OnClientConnectArgs
is cautioned with red underline, which obviously means no good and not going to work.
I was an OK C# coder before, and now I do node.js.
I know what they try to do is
var myController = XSocketCotroller();
var myController_onOpen = function(obj,e)
{
// The connection is open...
};
myControler.onOpen = myController_onOpen;
simple enough, but I don't know how to do this in C#.
Could you instruct. Thanks!