Skip to content

Instantly share code, notes, and snippets.

@nkalra0123
Created June 27, 2021 11:45
Show Gist options
  • Save nkalra0123/5aab1a1475f448c999745c21a59dca53 to your computer and use it in GitHub Desktop.
Save nkalra0123/5aab1a1475f448c999745c21a59dca53 to your computer and use it in GitHub Desktop.
protected boolean isWebsocketRequested(IHTTPSession session) {
Map<String, String> headers = session.getHeaders();
String upgrade = headers.get(NanoWSD.HEADER_UPGRADE);
boolean isCorrectConnection = isWebSocketConnectionHeader(headers);
boolean isUpgrade = NanoWSD.HEADER_UPGRADE_VALUE.equalsIgnoreCase(upgrade);
return isUpgrade && isCorrectConnection;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment