Beispiel #1
0
        public void SendResponse(WebSocketResponseMessage response)
        {
            WebSocketMessage message = new WebSocketMessage
            {
                Type     = WebSocketMessage.Types.Type.Response,
                Response = response
            };

            WebSocket.OutgoingQueue.Add(message.ToByteArray());
        }
Beispiel #2
0
        public async Task sendResponse(WebSocketResponseMessage response)
        {
            if (socket == null)
            {
                throw new Exception("Connection closed!");
            }

            WebSocketMessage message = WebSocketMessage.CreateBuilder()
                                       .SetType(WebSocketMessage.Types.Type.RESPONSE)
                                       .SetResponse(response)
                                       .Build();

            messageWriter.WriteBytes(message.ToByteArray());
            await messageWriter.StoreAsync();
        }