コード例 #1
0
ファイル: WebServer.cs プロジェクト: Emudofus/ArkaliaCore
 public static void OnConnected(UserContext context)
 {
     Utilities.Logger.Debug("New websocket connection : " + context.ClientAddress.ToString());
     var client = new WebClientConnection(context);
     lock (Clients)
     {
         Clients.Add(new WebClientConnection(context));
     }
 }
コード例 #2
0
ファイル: WebTunnel.cs プロジェクト: cabal95/localsubway
        /// <summary>
        /// Creates a new connection for the tunnel.
        /// </summary>
        /// <param name="session">The session that will own the connection.</param>
        /// <param name="connectionId"></param>
        /// <returns>
        /// The <see cref="T:BlueBoxMoon.LocalSubway.Connection" /> that can now be added to the tunnel.
        /// </returns>
        public override async Task <Connection> CreateConnectionAsync(ClientSession session, Guid connectionId)
        {
            SubwayTcpClient socket;

            if (_useSsl)
            {
                socket = new SubwaySslClient(_hostname, _port);
            }
            else
            {
                socket = new SubwayTcpClient(_hostname, _port);
            }

            var connection = new WebClientConnection(connectionId, Id, session, socket, _hostname);
            await connection.StartAsync();

            return(connection);
        }