コード例 #1
0
        private void OnMessageReceived(WebSocketConnection sender, WebSocketRequestMessage request)
        {
            WebSocketResponseMessage response = createWebSocketResponse(request);

            Debug.WriteLine($"Verb: {request.Verb}, Path {request.Path}, Body({request.Body.Length}): {request.Body}, Id: {request.Id}");

            try
            {
                if (isSignalServiceEnvelope(request))
                {
                    SignalServiceEnvelope envelope = new SignalServiceEnvelope(request.Body.ToByteArray(),
                                                                               credentialsProvider.GetSignalingKey());

                    MessageReceived(this, envelope);
                }
            }
            //catch (Exception e) { } // ignore for now
            finally
            {
                websocket.sendResponse(response);
            }
        }