private void Handshake(string TransportName, HttpListenerRequest Request, HttpListenerResponse Response) { void OnError() { EngineIOHttpManager.SendErrorMessage(Request, Response, Exceptions.BAD_REQUEST); } try { if (EngineIOHttpManager.IsPolling(TransportName)) { EngineIOTransport Transport = new EngineIOPolling(Request); Transport.OnRequest(Request, Response); Handshake(EngineIOSocketID.Generate(), Transport); } else { OnError(); } } catch (Exception Exception) { EngineIOLogger.Error(this, Exception); OnError(); } }
private void Handshake(string TransportName, WebSocketContext Context) { void OnError() { Context.WebSocket.Close(CloseStatusCode.Abnormal, Exceptions.BAD_REQUEST.Message); } try { if (EngineIOHttpManager.IsWebSocket(TransportName)) { Handshake(Context.QueryString["sid"] ?? EngineIOSocketID.Generate(), new EngineIOWebSocket(Context)); } else { OnError(); } } catch (Exception Exception) { EngineIOLogger.Error(this, Exception); OnError(); } }