This project is read-only.

Acknowledgement Callback

Apr 18, 2014 at 3:16 AM
Hi all,
I'm trying to use SocketIO4Net for communication with my NodeJS server. As mentioned by the NodeJS SocketIO doc, we can do something like:
var io = require('').listen(80);

io.sockets.on('connection', function (socket) {
  socket.on('ferret', function (name, fn) {
Where there's a fn refers to a callback function. I need equivalent function in SocketIO4Net but I can't find it any where. Only 2 signatures I found here are:
public virtual void On(string eventName, Action<IMessage> action);
public virtual void On(string eventName, string endPoint, Action<IMessage> action);
So I'm wondering, is this function available in SocketIO4Net? Or do I have to emit another event to confirm with the server?
Apr 20, 2014 at 5:50 PM
In the sample project, you'll find this sample:
public void CallbackExample()
     Console.WriteLine("Emit [socket].[messageAck] - should recv callback [root].[messageAck]");
     socket.Emit("messageAck", new { hello = "mama" }, null,
        (callback) =>
                var jsonMsg = callback as JsonEncodedEventMessage; // callback will be of type JsonEncodedEventMessage, cast for intellisense
                Console.WriteLine(string.Format("callback [root].[messageAck]: {0} \r\n", jsonMsg.Args));
Try it out and let me know if you have any issues...