NetEase / UnitySocketIO

socket.io client for unity3d.
889 stars 229 forks source link

Message Event is null #8

Closed vrwalking closed 11 years ago

vrwalking commented 11 years ago

I was following 'How to use' :

private void SocketMessage (object sender, MessageEventArgs e) { if ( e!= null && e.Message.Event == "message") { string msg = e.Message.MessageText; process(msg); } }

But e.Message.Event is Null except if we use socket.send(string) on server.

socket.emit('loveall',{love:'emitting love'}) on server side gives null and not 'loveall' as event.

I am aware of the event handling from other issue posts, is this connected to that? without this i need to parse the whole messagetext to get the event name.Please help if i am doing any wrong.

halfblood369 commented 11 years ago

Yes, send() and SocketMessage() can be used in unitysocketio, and you should develop your event handler as https://github.com/NetEase/pomelo-unityclient/blob/master/pomelo-unityclient/pomelo-unityclient/EventManager.cs . The same is as issue https://github.com/NetEase/UnitySocketIO/issues/7 .

vrwalking commented 11 years ago

ok, thanks