Beispiel #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;
 }
 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)));
 }
 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", ""));
 }
 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));
 }
        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);
        }
Beispiel #6
0
 private void WebSocket_OnError(BrainCloudWebSocket sender, string message)
 {
     m_clientRef.Log("Error: " + message);
     addRTTCommandResponse(new RTTCommandResponse(ServiceName.RTTRegistration.Value, "error", message));
 }
Beispiel #7
0
        private void WebSocket_OnMessage(BrainCloudWebSocket sender, byte[] data)
        {
            string message = Encoding.UTF8.GetString(data);

            onRecv(message);
        }
Beispiel #8
0
 private void Websocket_OnOpen(BrainCloudWebSocket accepted)
 {
     m_clientRef.Log("Connection established.");
     addRTTCommandResponse(new RTTCommandResponse(ServiceName.RTTRegistration.Value, "connect", ""));
 }
Beispiel #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));
 }