Skip to content
This repository was archived by the owner on Mar 6, 2018. It is now read-only.

Update WebsocketTransport.java #94

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/io/socket/WebsocketTransport.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class WebsocketTransport extends WebSocketClient implements IOTransport {
private final static Pattern PATTERN_HTTP = Pattern.compile("^http");
public static final String TRANSPORT_NAME = "websocket";
private IOConnection connection;
private static ExecutorService exec1;
public static IOTransport create(URL url, IOConnection connection) {
URI uri = URI.create(
PATTERN_HTTP.matcher(url.toString()).replaceFirst("ws")
Expand All @@ -30,7 +31,11 @@ public WebsocketTransport(URI uri, IOConnection connection) {
this.connection = connection;
SSLContext context = IOConnection.getSslContext();
if("wss".equals(uri.getScheme()) && context != null) {
this.setWebSocketFactory(new DefaultSSLWebSocketClientFactory(context));
if(exec1!=null){
exec1= Executors.newSingleThreadScheduledExecutor();
}
this.setWebSocketFactory(new DefaultSSLWebSocketClientFactory(context,exec1));

}
}

Expand Down Expand Up @@ -98,4 +103,4 @@ public void onError(Exception ex) {
// TODO Auto-generated method stub

}
}
}