-
Notifications
You must be signed in to change notification settings - Fork 2.6k
PerMessageDeflateExample
Chen edited this page Jul 28, 2020
·
6 revisions
###Introduction### Enable the extension with reference to both a server and client example as follow: PerMessageDeflateExample
###How does it work### WebSocket Per-Message Compression Extension
###Example### 1.1 DeflateClient:
private static final Draft perMessageDeflateDraft = new Draft_6455(new PerMessageDeflateExtension());
private static class DeflateClient extends WebSocketClient {
public DeflateClient() throws URISyntaxException {
super(new URI("ws://localhost:" + PORT), perMessageDeflateDraft);
}
1.2 DefalteServer:
private static class DeflateServer extends WebSocketServer {
public DeflateServer() {
super(new InetSocketAddress(PORT), Collections.singletonList(perMessageDeflateDraft));
}