internal WebSocketServerSide(Stream socketStream, WebSocket client, HttpServer server)
 {
     _socketStream = socketStream;
     _currentFrameBuffer = new byte[256];
     _currentFrameBufferCount = 0;
     _currentMessage = null;
     _client = client;
     _server = server;
     _ended = false;
     beginRead();
 }
Beispiel #2
0
 /// <summary>
 ///     Returns an <see cref="HttpResponseWebSocket"/> which indicates to the client that the HTTP connection should
 ///     switch to the WebSocket protocol.</summary>
 /// <param name="websocket">
 ///     The <see cref="WebSocket"/> implementation to use for the remainder of the connection.</param>
 /// <param name="subprotocol">
 ///     The server’s selection of a subprotocol, if the client specified any subprotocols in the request.</param>
 /// <param name="headers">
 ///     Optional HTTP response headers.</param>
 public static HttpResponseWebSocket WebSocket(WebSocket websocket, string subprotocol = null, HttpResponseHeaders headers = null)
 {
     if (websocket == null)
         throw new ArgumentNullException("websocket");
     return new HttpResponseWebSocket(websocket, subprotocol, headers);
 }
 /// <summary>
 ///     Constructor.</summary>
 /// <param name="websocket">
 ///     The <see cref="WebSocket"/> implementation to use for the remainder of the connection.</param>
 /// <param name="subprotocol">
 ///     The server’s selection of a subprotocol, if the client specified any subprotocols in the request.</param>
 /// <param name="headers">
 ///     Optional HTTP response headers.</param>
 public HttpResponseWebSocket(WebSocket websocket, string subprotocol = null, HttpResponseHeaders headers = null)
     : base(headers ?? new HttpResponseHeaders())
 {
     Subprotocol = subprotocol;
     Websocket = websocket;
 }