public NewICEAvailableResponse Handle(NewICEAvailableRequest request)
        {
            var clients = _socketRepository.GetAllClients();

            _iceRepository.AddEntry(request.ICEData);
            var iceNotification = new NewICEAvailableNotification(request.ICEData);

            foreach (var client in clients)
            {
                _socketNotifier.SendMessageAsync(client.Socket, iceNotification);
            }

            return(new NewICEAvailableResponse(true));
        }
Example #2
0
        private async Task HandleSocket(WebSocket socket, WebSocketReceiveResult result, byte[] buffer, IPAddress address)
        {
            if (result.MessageType == WebSocketMessageType.Text)
            {
                var response   = _requestProcessor.ProcessRequest(buffer, address, socket);
                var serialized = JsonConvert.SerializeObject(response);
                await _notifier.SendMessageAsync(socket, serialized);

                return;
            }

            else if (result.MessageType == WebSocketMessageType.Close)
            {
                return;
            }
        }