Exemple #1
0
        private async Task ProcessMessageAsync(WebSocket webSocket, byte[] buffer, int count)
        {
            var msg = WebSocketMessage.FromJson(buffer, count);

            msg.WebSocket = webSocket;

            if (logger != null)
            {
                await logger.LogDebug($"Received message: {msg.Method}");
            }

            var waitingMessage = questionMessages.FirstOrDefault(x => x.Id == msg.QuestionId);

            if (waitingMessage != null)
            {
                waitingMessage.Respond(msg);
            }
            else
            {
                await ReceiveMessage(msg);
            }
        }