public static IHandler BuildHandler( WebSocketHttpRequest request, Action <string> onMessage, Action onClose, Action <byte[]> onBinary, Action <byte[]> onPing, Action <byte[]> onPong) { var version = GetVersion(request); switch (version) { case "76": return(Draft76Handler.Create(request, onMessage)); case "7": case "8": case "13": return(Hybi13Handler.Create(request, onMessage, onClose, onBinary, onPing, onPong)); case "policy-file-request": return(FlashSocketPolicyRequestHandler.Create(request)); } throw new WebSocketException(WebSocketStatusCodes.UnsupportedDataType); }
public void Setup() { _request = new WebSocketHttpRequest(); _onClose = delegate { }; _onMessage = delegate { }; _handler = Hybi13Handler.Create(_request, s => _onMessage(s), () => _onClose()); }
public static IHandler BuildHandler(WebSocketHttpRequest request, Action <string> onMessage, Fleck2Extensions.Action onClose, Action <byte[]> onBinary) { var version = GetVersion(request); switch (version) { case "76": return(Draft76Handler.Create(request, onMessage)); case "7": case "8": case "13": return(Hybi13Handler.Create(request, onMessage, onClose, onBinary)); } throw new WebSocketException(WebSocketStatusCodes.UnsupportedDataType); }
public static IHandler BuildHandler(WebSocketHttpRequest request, Action <string> onMessage, Action onClose) { var version = GetVersion(request); switch (version) { case "76": return(Draft76Handler.Create(request, onMessage)); case "7": return(Hybi13Handler.Create(request, onMessage, onClose)); case "8": return(Hybi13Handler.Create(request, onMessage, onClose)); case "13": return(Hybi13Handler.Create(request, onMessage, onClose)); } throw new WebSocketException("Unsupported Request"); }