Skip to content

Commit 302827a

Browse files
committed
update README
1 parent 9d6947a commit 302827a

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,19 @@ socket.on("foo", new Emitter.Listener() {
125125
SSL (HTTPS, WSS) settings:
126126

127127
```java
128+
OkHttpClient okHttpClient = new OkHttpClient.Builder()
129+
.hostnameVerifier(myHostnameVerifier)
130+
.sslSocketFactory(mySSLContext.getSocketFactory(), myX509TrustManager)
131+
.build();
132+
128133
// default settings for all sockets
129-
IO.setDefaultSSLContext(mySSLContext);
130-
IO.setDefaultHostnameVerifier(myHostnameVerifier);
134+
Socket.setDefaultOkHttpWebSocketFactory(okHttpClient);
135+
Socket.setDefaultOkHttpCallFactory(okHttpClient);
131136

132137
// set as an option
133138
opts = new IO.Options();
134-
opts.sslContext = mySSLContext;
135-
opts.hostnameVerifier = myHostnameVerifier;
139+
opts.callFactory = okHttpClient;
140+
opts.webSocketFactory = okHttpClient;
136141
socket = IO.socket("https://localhost", opts);
137142
```
138143

0 commit comments

Comments
 (0)