0

We are using Pomelo for networking in our game. Unity Client is registered for some broadcast events, in very rare cases broadcast messages are not received by the unity client. But the messages are broadcasted from the server.

I have tried putting logs in SocketMessage method of PomeloClient but no logs were printed. If anyone has any clue or suggestions about the problem, then please reply.

/// <summary>
    /// When message from server comes, it invoke.
    /// </summary>
    /// <param name='sender'>
    /// Sender.
    /// </param>
    /// <param name='e'>
    /// E.
    /// </param>
    private void SocketMessage (object sender, MessageEventArgs e) {
        UnityEngine.Debug.Log("Unfiltered Message from  server :" + e.Message);

        if ( e!= null && e.Message.Event == "message") {
            string msg = e.Message.MessageText;
            if (msg.IndexOf(ARRAY_FLAG) == 0) {
                this.processMessageBatch(msg);
            } else {
                this.processMessage(msg);
            }
        }
    }
CodeSmile
  • 64,284
  • 20
  • 132
  • 217
  • are the messages sent reliably? If not, there's always the chance for packet loss and the game needs to compensate for that. – CodeSmile Nov 17 '14 at 11:58

1 Answers1

0

try:https://github.com/kaistseo/UnitySocketIO-WebSocketSharp

UnitySocketIO using websocket-sharp instead of WebSocket4Net

UnitySocketIO is the only usable socket.io client for unity3d, but it's using WebSocket4Net and SuperSocket.ClientEngine as underlying libraries, which are somewhat buggy and unstable. There are times when the MessageReceived event handler is not called, even though the client has received a message packet from the server, and the message silently gets dropped. When WebSocket4Net library used by UnitySocketIO was replaced with websocket-sharp, the problem has been solved. SimpleJson library used by UnitySocketIO was updated to the latest version (v0.30.0), because the old one caused crashes in some cases.