private void HandleMainJuryConnection(WebSocket socket, Message message)
        {
            if (message.RequestType == MessageType.JuryConnected)
            {
                _jurySocketId = WebSocketConnectionManager.GetId(socket);
            }

            if (message.RequestType == MessageType.EndFight)
            {
                _jurySocketId = string.Empty;
            }
        }
        private async Task ExcecuteResponse(WebSocket socket, HandlerResponse handlerResponse)
        {
            if (handlerResponse.ResponseType == ResponseType.ToAll)
            {
                await SendMessageToAllAsync(handlerResponse.Message);
            }
            if (handlerResponse.ResponseType == ResponseType.ToOne)
            {
                await SendMessageAsync(_jurySocketId, handlerResponse.Message);
            }

            if (handlerResponse.ResponseType == ResponseType.ToSelf)
            {
                var socketId = WebSocketConnectionManager.GetId(socket);
                await SendMessageAsync(socketId, handlerResponse.Message);
            }
        }
 public FightHandler(WebSocketConnectionManager connectionManager, IMessageHandlerChainFactory messageHandlerChainFactory) : base(connectionManager)
 {
     _messageHandler = messageHandlerChainFactory.CreateMessageHandlerChain();
     _mutex          = new SemaphoreSlim(1);
 }
Esempio n. 4
0
 protected WebSocketHandler(WebSocketConnectionManager webSocketConnectionManager)
 {
     WebSocketConnectionManager = webSocketConnectionManager;
 }