Exemple #1
0
    /**
     * `ControllerInput` class instances use this method to send messages to their controllers over the network.
     * You should NOT call this method yourself.
     *
     * @throws ApplicationException if currently there is no connection to the controller of that player.
     */
    public void SendTo(int playerId, Message msg)
    {
        string websocketId;

        if (_clients.TryGetWebsocketId(playerId, out websocketId))
        {
            SendToByWebsocketId(websocketId, msg);
        }

        else
        {
            throw new ApplicationException("Tried to send to player who is not connected.");
        }
    }