Esempio n. 1
0
        /// <summary>
        /// Create a new WebSocket server.
        /// </summary>
        /// <param name="config">The configuration the server will use.</param>
        /// <param name="ipAddress">The IP address the server should listen on.</param>
        /// <param name="port">The port the server should listen on.</param>
        /// <param name="cert">The X509 certificate the server should use (automatically enforces SSL)</param>
        public WsLiteServer(WebSocketConfig config, IPAddress ipAddress, int port, X509Certificate cert = null)
        {
            tcp = new TcpListener(ipAddress, port);

            this.config = config;
            this.cert   = cert;
        }
Esempio n. 2
0
        /// <param name="id">A unique identifier for the connection.</param>
        /// <param name="config">The server's configuration.</param>
        /// <param name="stream">The stream to exchange frames on.</param>
        internal WsLiteConnection(Guid id, WebSocketConfig config, Stream stream, CancellationToken ct)
        {
            this.Id     = id;
            this.stream = stream;
            this.config = config;
            this.ct     = ct;

            this.messageBuffer = HttpHandshakeUtility.ArrayPool.Rent(config.BufferSize * config.MaxFrameCount);
        }