|
1 | 1 | <!DOCTYPE html> |
2 | 2 | <!-- |
3 | | - | Generated by Apache Maven Doxia Site Renderer 1.9.2 from src/site/markdown/faq.md at 2022-07-04 |
| 3 | + | Generated by Apache Maven Doxia Site Renderer 1.9.2 from src/site/markdown/faq.md at 2022-07-07 |
4 | 4 | | Rendered using Apache Maven Fluido Skin 1.9 |
5 | 5 | --> |
6 | 6 | <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> |
|
32 | 32 |
|
33 | 33 | <div id="breadcrumbs"> |
34 | 34 | <ul class="breadcrumb"> |
35 | | - <li id="publishDate">Last Published: 2022-07-04<span class="divider">|</span> |
| 35 | + <li id="publishDate">Last Published: 2022-07-07<span class="divider">|</span> |
36 | 36 | </li> |
37 | 37 | <li id="projectVersion">Version: 2.0.2-SNAPSHOT</li> |
38 | 38 | </ul> |
|
49 | 49 | <li><a href="listening_to_events.html" title="Listening to events"><span class="none"></span>Listening to events</a></li> |
50 | 50 | <li><a href="socket_instance.html" title="The Socket instance"><span class="none"></span>The Socket instance</a></li> |
51 | 51 | <li><a href="migrating_from_1_x.html" title="Migrating from 1.x"><span class="none"></span>Migrating from 1.x</a></li> |
| 52 | + <li><a href="logging.html" title="Logging"><span class="none"></span>Logging</a></li> |
52 | 53 | <li class="active"><a href="#"><span class="none"></span>FAQ</a></li> |
53 | 54 | <li><a href="android.html" title="Android"><span class="none"></span>Android</a></li> |
54 | 55 | <li class="nav-header">Miscellaneous</li> |
|
72 | 73 | <h1>Frequently asked questions</h1> |
73 | 74 | <ul> |
74 | 75 | <li><a href="#How_to_deal_with_cookies">How to deal with cookies</a></li> |
75 | | -<li><a href="#How_to_use_with_AWS_Load_Balancing">How to use with AWS Load Balancing</a></li></ul> |
| 76 | +<li><a href="#How_to_use_with_AWS_Load_Balancing">How to use with AWS Load Balancing</a></li> |
| 77 | +<li><a href="#How_to_force_TLS_v1.2_and_above">How to force TLS v1.2 and above</a></li></ul> |
76 | 78 | <section> |
77 | 79 | <h2><a name="How_to_deal_with_cookies"></a>How to deal with cookies</h2> |
78 | 80 | <p>In order to store the cookies sent by the server and include them in all subsequent requests, you need to create an OkHttpClient with a custom <a class="externalLink" href="https://square.github.io/okhttp/4.x/okhttp/okhttp3/-cookie-jar/">cookie jar</a>.</p> |
@@ -186,7 +188,29 @@ <h2><a name="How_to_use_with_AWS_Load_Balancing"></a>How to use with AWS Load Ba |
186 | 188 | <p>When scaling to multiple Socket.IO servers, you must ensure that all the HTTP requests of a given session reach the same server (explanation <a class="externalLink" href="https://socket.io/docs/v4/using-multiple-nodes/#why-is-sticky-session-required">here</a>).</p> |
187 | 189 | <p>Sticky sessions can be enabled on AWS Application Load Balancers, which works by sending a cookie (<code>AWSALB</code>) to the client.</p> |
188 | 190 | <p>Please see <a href="#how-to-deal-with-cookies">above</a> for how to deal with cookies.</p> |
189 | | -<p>Reference: <a class="externalLink" href="https://docs.aws.amazon.com/elasticloadbalancing/latest/application/sticky-sessions.html">https://docs.aws.amazon.com/elasticloadbalancing/latest/application/sticky-sessions.html</a></p></section> |
| 191 | +<p>Reference: <a class="externalLink" href="https://docs.aws.amazon.com/elasticloadbalancing/latest/application/sticky-sessions.html">https://docs.aws.amazon.com/elasticloadbalancing/latest/application/sticky-sessions.html</a></p></section><section> |
| 192 | +<h2><a name="How_to_force_TLS_v1.2_and_above"></a>How to force TLS v1.2 and above</h2> |
| 193 | +<p>This library relies on the OkHttp library to create HTTP requests and WebSocket connections.</p> |
| 194 | +<p>Reference: <a class="externalLink" href="https://square.github.io/okhttp/">https://square.github.io/okhttp/</a></p> |
| 195 | +<p>We currently depend on version <code>3.12.12</code>, which is the last version that supports Java 7+ and Android 2.3+ (API level 9+). With this version, the OkHttpClient allows <code>TLSv1</code> and <code>TLSv1.1</code> by default (<a class="externalLink" href="https://square.github.io/okhttp/security/tls_configuration_history/#modern_tls-versions_1">MODERN_TLS</a> configuration).</p> |
| 196 | +<p>You can overwrite it by providing your own OkHttp client:</p> |
| 197 | + |
| 198 | +<div class="source"> |
| 199 | +<div class="source"><pre class="prettyprint">OkHttpClient okHttpClient = new OkHttpClient.Builder() |
| 200 | + .connectionSpecs(Arrays.asList( |
| 201 | + ConnectionSpec.RESTRICTED_TLS |
| 202 | + )) |
| 203 | + .readTimeout(1, TimeUnit.MINUTES) // important for HTTP long-polling |
| 204 | + .build(); |
| 205 | + |
| 206 | +IO.Options options = new IO.Options(); |
| 207 | +options.callFactory = okHttpClient; |
| 208 | +options.webSocketFactory = okHttpClient; |
| 209 | + |
| 210 | +Socket socket = IO.socket(URI.create("https://example.com"), options); |
| 211 | +</pre></div></div> |
| 212 | + |
| 213 | +<p>Note: we will upgrade to OkHttp 4 in the next major version.</p></section> |
190 | 214 | </main> |
191 | 215 | </div> |
192 | 216 | </div> |
|
0 commit comments