Adding examples of managing the websocket extensions
This commit is contained in:
parent
6b1f17b503
commit
395e8f1c8b
|
@ -83,8 +83,9 @@ public class BrowserDebugTool implements WebSocketCreator
|
||||||
|
|
||||||
String ua = req.getHeader("User-Agent");
|
String ua = req.getHeader("User-Agent");
|
||||||
String rexts = req.getHeader("Sec-WebSocket-Extensions");
|
String rexts = req.getHeader("Sec-WebSocket-Extensions");
|
||||||
|
|
||||||
LOG.debug("User-Agent: {}", ua);
|
LOG.debug("User-Agent: {}", ua);
|
||||||
LOG.debug("Sec-WebSocket-Extensions: {}", rexts);
|
LOG.debug("Sec-WebSocket-Extensions (Request) : {}", rexts);
|
||||||
return new BrowserSocket(ua,rexts);
|
return new BrowserSocket(ua,rexts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,6 +114,10 @@ public class BrowserDebugTool implements WebSocketCreator
|
||||||
{
|
{
|
||||||
LOG.debug("Configuring WebSocketServerFactory ...");
|
LOG.debug("Configuring WebSocketServerFactory ...");
|
||||||
|
|
||||||
|
// factory.getExtensionFactory().unregister("deflate-frame");
|
||||||
|
// factory.getExtensionFactory().unregister("permessage-deflate");
|
||||||
|
// factory.getExtensionFactory().unregister("x-webkit-deflate-frame");
|
||||||
|
|
||||||
// Setup the desired Socket to use for all incoming upgrade requests
|
// Setup the desired Socket to use for all incoming upgrade requests
|
||||||
factory.setCreator(BrowserDebugTool.this);
|
factory.setCreator(BrowserDebugTool.this);
|
||||||
|
|
||||||
|
|
|
@ -135,8 +135,10 @@ public class BrowserSocket
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
writeMessage("Client Sec-WebSocket-Extensions: " + this.requestedExtensions);
|
writeMessage("Client requested Sec-WebSocket-Extensions: " + this.requestedExtensions);
|
||||||
|
writeMessage("Negotiated Sec-WebSocket-Extensions: " + session.getUpgradeResponse().getHeader("Sec-WebSocket-Extensions"));
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "many":
|
case "many":
|
||||||
|
@ -225,7 +227,7 @@ public class BrowserSocket
|
||||||
}
|
}
|
||||||
|
|
||||||
// Async write
|
// Async write
|
||||||
session.getRemote().sendString(message, null);
|
session.getRemote().sendString(message,null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeMessage(String format, Object... args)
|
private void writeMessage(String format, Object... args)
|
||||||
|
|
Loading…
Reference in New Issue