Пример #1
0
 private void setupWebSocket(string in_url)
 {
     m_webSocket            = new BrainCloudWebSocket(in_url);
     m_webSocket.OnClose   += WebSocket_OnClose;
     m_webSocket.OnOpen    += Websocket_OnOpen;
     m_webSocket.OnMessage += WebSocket_OnMessage;
     m_webSocket.OnError   += WebSocket_OnError;
 }
Пример #2
0
 private void WebSocket_OnError(BrainCloudWebSocket sender, string message)
 {
     if (m_clientRef.LoggingEnabled)
     {
         m_clientRef.Log("RTT Error: " + message);
     }
     m_webSocketStatus = WebsocketStatus.ERROR;
     addRTTCommandResponse(new RTTCommandResponse(ServiceName.RTTRegistration.Value.ToLower(), "error", buildRTTRequestError(message)));
 }
Пример #3
0
 private void Websocket_OnOpen(BrainCloudWebSocket accepted)
 {
     if (m_clientRef.LoggingEnabled)
     {
         m_clientRef.Log("RTT: Connection established.");
     }
     m_webSocketStatus = WebsocketStatus.OPEN;
     addRTTCommandResponse(new RTTCommandResponse(ServiceName.RTTRegistration.Value.ToLower(), "connect", ""));
 }
Пример #4
0
 private void WebSocket_OnClose(BrainCloudWebSocket sender, int code, string reason)
 {
     if (m_clientRef.LoggingEnabled)
     {
         m_clientRef.Log("RTT: Connection closed: " + reason);
     }
     m_webSocketStatus = WebsocketStatus.CLOSED;
     addRTTCommandResponse(new RTTCommandResponse(ServiceName.RTTRegistration.Value.ToLower(), "disconnect", reason));
 }
Пример #5
0
        private void WebSocket_OnMessage(BrainCloudWebSocket sender, byte[] data)
        {
            if (data.Length == 0)
            {
                return;
            }
            m_webSocketStatus = WebsocketStatus.MESSAGE;
            string message = Encoding.UTF8.GetString(data);

            onRecv(message);
        }
Пример #6
0
 private void WebSocket_OnError(BrainCloudWebSocket sender, string message)
 {
     m_clientRef.Log("Error: " + message);
     addRTTCommandResponse(new RTTCommandResponse(ServiceName.RTTRegistration.Value, "error", message));
 }
Пример #7
0
        private void WebSocket_OnMessage(BrainCloudWebSocket sender, byte[] data)
        {
            string message = Encoding.UTF8.GetString(data);

            onRecv(message);
        }
Пример #8
0
 private void Websocket_OnOpen(BrainCloudWebSocket accepted)
 {
     m_clientRef.Log("Connection established.");
     addRTTCommandResponse(new RTTCommandResponse(ServiceName.RTTRegistration.Value, "connect", ""));
 }
Пример #9
0
 private void WebSocket_OnClose(BrainCloudWebSocket sender, int code, string reason)
 {
     m_clientRef.Log("Connection closed: " + reason);
     addRTTCommandResponse(new RTTCommandResponse(ServiceName.RTTRegistration.Value, "disconnect", reason));
 }