This project is read-only.

Payload optional?

Nov 9, 2012 at 3:38 AM

In my javascript client:

iosocket.emit('heartbeat'); 

and in my node.js server

socket.on('heartbeat', function() { socket.emit('heartbeat'); });

 

 

I can't seem to fire that event on my server with this c# client ... any ideas?

Nov 21, 2012 at 2:10 PM

Hi,

I encountered the same issue: Trying to emit an event without payload:

socket.emit('hello');

And the event is not catched (the SocketMessage function (in TestSocketIOClient.cs) which displays the "non-registered messages" is called instead). After having a look at the code, it appears that the problem is in the EventMessage class:

 

if (!string.IsNullOrEmpty(evtMsg.MessageText) && evtMsg.MessageText.Contains("name") && evtMsg.MessageText.Contains("args"))
{
    evtMsg.Json = JsonEncodedEventMessage.Deserialize(evtMsg.MessageText);
    evtMsg.Event = evtMsg.Json.Name;
}

 

Would it be possible to remove the check && evtMsg.MessageText.Contains("args") so we can emit events without payload?

Thanks!
Otherwise, thank you for this very cool lib!