/// <summary> /// Raises the StandardHttpRequestReceived event. /// </summary> /// <param name="e">A <see cref="StandardHttpRequestReceivedEventArgs"/> that contains the event data.</param> protected void OnStandardHttpRequestReceived(StandardHttpRequestReceivedEventArgs e) { if (this.StandardHttpRequestReceived != null) { this.StandardHttpRequestReceived(this, e); } }
/// <summary> /// Fires the StandardHttpRequestReceived event. /// </summary> /// <param name="e">A <see cref="StandardHttpRequestReceivedEventArgs"/> that contains the event data.</param> protected void OnStandardHttpRequestReceived(StandardHttpRequestReceivedEventArgs e) { if (this.StandardHttpRequestReceived != null) { // The event handler is to be fired, so set the Handled // property to true. If the user decides to let the non-handled // case happen, he can set the property to false in the event // handler. e.Handled = true; this.StandardHttpRequestReceived(this, e); } }
private void CreateHandler(IEnumerable <byte> data) { var request = this.parser.Parse(data.ToArray(), this.scheme); if (request == null) { return; } try { this.Handler = HandlerFactory.BuildHandler(request); } catch (WebSocketException) { StandardHttpRequestReceivedEventArgs e = new StandardHttpRequestReceivedEventArgs(this); this.OnStandardHttpRequestReceived(e); if (!e.Handled) { throw; } } if (this.Handler == null) { return; } this.Handler.TextMessageHandled += new EventHandler <TextMessageHandledEventArgs>(this.Handler_TextMessageHandled); this.Handler.BinaryMessageHandled += new EventHandler <BinaryMessageHandledEventArgs>(this.Handler_BinaryMessageHandled); this.Handler.CloseHandled += new EventHandler(this.Handler_CloseHandled); this.ConnectionInfo = WebSocketConnectionInfo.Create(request, this.Socket.RemoteIPAddress); var handshake = this.Handler.CreateHandshake(); this.SendBytes(handshake); this.OnOpen(new ConnectionEventArgs(this)); }
private void ConnectionStandardHttpRequestReceivedEventHandler(object sender, StandardHttpRequestReceivedEventArgs e) { this.OnStandardHttpRequestReceived(e); }