/* LiteNetLib handler */ public override void OnNetworkReceive(NetPeer connection, NetDataReader reader) { PayloadMessage message = ProtobufUtility.Unserialize <PayloadMessage>(reader.Data); var sessionId = _sessions.GetBySecond(connection); _lastMessageTicks[sessionId] = DateTime.Now.Ticks; _handleMessage(message.payload, sessionId); }
/* LiteNetLib handler */ public override void OnNetworkReceive(NetPeer connection, NetDataReader reader) { try { PayloadMessage message = ProtobufUtility.Unserialize <PayloadMessage>(reader.Data); //Debug.Log("Received message " + message.payload.GetType()); _handleMessage(message.payload); } catch (Exception e) { Debug.LogError("Error while receiving message: " + e); } }