2121import io .netty .handler .codec .http .websocketx .WebSocketClientHandshaker ;
2222import io .netty .handler .codec .http .websocketx .WebSocketClientHandshakerFactory ;
2323import io .netty .handler .codec .http .websocketx .WebSocketVersion ;
24+ import io .netty .handler .codec .http .websocketx .extensions .compression .WebSocketClientCompressionHandler ;
2425import io .netty .handler .ssl .SslContext ;
2526import io .netty .handler .ssl .SslContextBuilder ;
2627
3435import java .util .Map ;
3536import java .util .concurrent .Future ;
3637
37- /*
38+ /**
3839 * Provides functionality to verify and connect to a remote websocket.
3940 */
4041public final class WebsocketConnector
@@ -177,7 +178,7 @@ public static Future<?> createConnector( final IAPIEnvironment environment, fina
177178 httpHeaders .add ( header .getKey (), header .getValue () );
178179 }
179180
180- WebSocketClientHandshaker handshaker = WebSocketClientHandshakerFactory .newHandshaker ( uri , WebSocketVersion .V13 , null , false , httpHeaders );
181+ WebSocketClientHandshaker handshaker = WebSocketClientHandshakerFactory .newHandshaker ( uri , WebSocketVersion .V13 , null , true , httpHeaders );
181182 final WebsocketConnection connection = new WebsocketConnection ( environment , api , handshaker , address );
182183
183184 new Bootstrap ()
@@ -190,7 +191,12 @@ protected void initChannel( SocketChannel ch ) throws Exception
190191 {
191192 ChannelPipeline p = ch .pipeline ();
192193 if ( ssl != null ) p .addLast ( ssl .newHandler ( ch .alloc (), uri .getHost (), port ) );
193- p .addLast ( new HttpClientCodec (), new HttpObjectAggregator ( 8192 ), connection );
194+ p .addLast (
195+ new HttpClientCodec (),
196+ new HttpObjectAggregator ( 8192 ),
197+ WebSocketClientCompressionHandler .INSTANCE ,
198+ connection
199+ );
194200 }
195201 } )
196202 .remoteAddress ( socketAddress )
0 commit comments