Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created May 27, 2020 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/c2cdfa1004b8bafb7f5353c4d7226b70 to your computer and use it in GitHub Desktop.
Save bjoerntx/c2cdfa1004b8bafb7f5353c4d7226b70 to your computer and use it in GitHub Desktop.
[WebSocketAuth]
public class TXWebSocketController : ApiController {
public HttpResponseMessage Get() {
if (HttpContext.Current.IsWebSocketRequest) {
var wsHandler = new WebSocketHandler();
wsHandler.ProcessRequest(HttpContext.Current);
return new HttpResponseMessage(HttpStatusCode.SwitchingProtocols);
}
return new HttpResponseMessage(HttpStatusCode.OK);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment