Commit Graph

169 Commits

Author SHA1 Message Date
Damien Arrachequesne
246993387d chore(release): prepare release engine.io-client-2.1.0 2022-07-10 08:55:50 +02:00
Damien Arrachequesne
fb531fab30 fix: increase the readTimeout value of the default OkHttpClient
With the previous value (10 seconds by default), a connection
established with HTTP long-polling was closed if the server did not
send any packet for 10 seconds (the HTTP request would timeout from the
client side).

It will now default to 1 minute, which is above the
`pingInterval + pingTimeout` value from the server.

Note: the connectTimeout and writeTimeout options are left as is (10
seconds), but you may need to increase them depending on your use case:

```
OkHttpClient client = new OkHttpClient.Builder()
	.connectTimeout(20, TimeUnit.SECONDS)
	.readTimeout(1, TimeUnit.MINUTES)
	.writeTimeout(1, TimeUnit.MINUTES)
        .build();
```

Related:

- https://github.com/socketio/socket.io-client-java/issues/491
- https://github.com/socketio/socket.io-client-java/issues/660
2022-07-03 23:16:25 +02:00
dependabot[bot]
9be533fdf3 chore: bump engine.io from 4.0.5 to 4.1.2 in /src/test/resources (#110)
Bumps [engine.io](https://github.com/socketio/engine.io) from 4.0.5 to 4.1.2.
- [Release notes](https://github.com/socketio/engine.io/releases)
- [Changelog](https://github.com/socketio/engine.io/blob/4.1.2/CHANGELOG.md)
- [Commits](https://github.com/socketio/engine.io/compare/4.0.5...4.1.2)

---
updated-dependencies:
- dependency-name: engine.io
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-13 22:31:39 +01:00
valodzka
7c9c382505 feat: create heartbeat scheduler with named threads and as daemon (#106)
Co-authored-by: Pavel Valodzka <pavel@valodzka.name>
2021-01-22 10:41:06 +01:00
Damien Arrachequesne
62f13846d7 chore(release): prepare release engine.io-client-2.0.0 2020-12-11 15:19:59 +01:00
Damien Arrachequesne
cbd341c2c9 docs: update website 2020-12-11 15:16:25 +01:00
Damien Arrachequesne
2b5dfb99f8 fix: check the type of the initial packet
Before this fix, the client could mark the polling transport as open
even though the handshake packet was not received properly (for
example, after a parsing error).

See also: 1c8cba8818
2020-12-11 15:02:48 +01:00
Damien Arrachequesne
dfe65e3b3b feat: add an extraHeaders option
Similar to the option of the JS client:

```java
opts = new Socket.Options();
opts.extraHeaders = singletonMap("authorization", singletonList("bearer abcd"));
socket = new Socket(opts);
```

Note: the refactor of the options (similar to [1]) will be done in a
future step.

[1] 5f47a50ee5
2020-12-11 14:20:45 +01:00
Damien Arrachequesne
41f89a38b7 feat: add support for Engine.IO v4
Reference: https://github.com/socketio/engine.io-protocol#difference-between-v3-and-v4
2020-12-11 14:19:59 +01:00
Jacek Mleczek
6f065b7a62 fix: handle responses without content type (#101)
This fixes NullPointerException when response doesn't have content type. Exception stack trace:

```
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String okhttp3.MediaType.toString()' on a null object reference
        at io.socket.engineio.client.transports.PollingXHR$Request.onLoad(PollingXHR.java:271)
        at io.socket.engineio.client.transports.PollingXHR$Request.access$700(PollingXHR.java:148)
        at io.socket.engineio.client.transports.PollingXHR$Request$1.onResponse(PollingXHR.java:232)
        at okhttp3.RealCall$AsyncCall.execute(RealCall.java:141)
        at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:764)
```
2020-12-08 23:47:44 +01:00
Damien Arrachequesne
5c6519727f chore: bump engine.io server version 2020-12-08 11:18:16 +01:00
Damien Arrachequesne
9a7176bae6 ci: migrate to GitHub Actions
Due to the recent changes to the Travis CI platform (see [1]), we will
now use GitHub Actions to run the tests.

Note: the certificate was updated because it failed with newer Node.js versions

```
_tls_common.js:129
      c.context.setCert(cert);
                ^

Error: error:140AB18F:SSL routines:SSL_CTX_use_certificate:ee key too small
    at Object.createSecureContext (_tls_common.js:129:17)
    at Server.setSecureContext (_tls_wrap.js:1328:27)
```

Reference: https://docs.github.com/en/free-pro-team@latest/actions/guides/building-and-testing-java-with-maven

[1]: https://blog.travis-ci.com/2020-11-02-travis-ci-new-billing
2020-12-08 11:18:16 +01:00
nkzawa
17dc5b4a60 add loggable checks 2017-07-14 14:43:44 +09:00
nkzawa
c8867048dd add the transportOptions option 2017-07-13 12:51:29 +09:00
nkzawa
46de5813ca run tests against engine.io 3.1.0 2017-07-13 12:47:48 +09:00
nkzawa
1b3c795210 update parser to not utf8 encode for string payloads 2017-07-13 12:47:00 +09:00
nkzawa
8b07bbd9f0 utf8: add strict option 2017-07-12 12:31:41 +09:00
nkzawa
e4f1a56cfc test: shutdown okhttpclient 2017-07-12 12:30:12 +09:00
nkzawa
3ce2c9b72e cache response.body call just in case 2017-07-11 21:27:11 +09:00
nkzawa
f3d92f9aac polling-xhr: always close body 2017-07-11 21:26:22 +09:00
nkzawa
850a5110b9 set accept header 2017-07-11 19:44:30 +09:00
nkzawa
633120459f test against engine.io 1.8.4 2017-07-11 19:11:28 +09:00
nkzawa
bb323f00ae onPacket now emits data on 'closing' state as well 2017-07-11 19:10:40 +09:00
nkzawa
115f32171d parser: check empty arg 2017-07-11 18:16:49 +09:00
Yu-Hsuan Lin
c817af5b22 Options for inject okhttp Call/WebSocket factory 2017-05-02 17:07:43 +08:00
Yu-Hsuan Lin
657d8e89b5 okhttp-ws into okhttp 2016-12-02 16:26:28 +08:00
Akshat Goel
eb127d97e4 removed the doClose() inside catcher of IllegalStateException 2016-10-12 11:50:23 +05:30
Akshat Goel
35b2fa93fa fix added to fix following crash
Fatal Exception: java.lang.IllegalStateException: closed
       at okhttp3.internal.ws.RealWebSocket.sendMessage(RealWebSocket.java:107)
       at io.socket.engineio.client.transports.WebSocket$4.call(WebSocket.java:189)
       at io.socket.engineio.parser.Parser.encodePacket(Parser.java:63)
       at io.socket.engineio.parser.Parser.encodePacket(Parser.java:42)
       at io.socket.engineio.client.transports.WebSocket.write(WebSocket.java:184)
       at io.socket.engineio.client.Transport$3.run(Transport.java:108)
       at io.socket.thread.EventThread.exec(EventThread.java:55)
       at io.socket.engineio.client.Transport.send(Transport.java:103)
       at io.socket.engineio.client.Socket.flush(Socket.java:615)
       at io.socket.engineio.client.Socket.onDrain(Socket.java:606)
       at io.socket.engineio.client.Socket.access$1100(Socket.java:31)
       at io.socket.engineio.client.Socket$6.call(Socket.java:308)
       at io.socket.emitter.Emitter.emit(Emitter.java:117)
       at io.socket.engineio.client.transports.WebSocket$3$1.run(WebSocket.java:171)
       at io.socket.thread.EventThread$2.run(EventThread.java:80)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
       at java.lang.Thread.run(Thread.java:818)
2016-10-12 04:34:56 +05:30
Akshat Goel
1e72b45077 fixed added onClose 2016-09-26 20:53:59 +05:30
nkzawa
4b2df0d045 test: bump engine.io 2016-09-19 15:10:52 +02:00
Naoyuki Kanezawa
bf0f4aabae Merge pull request #62 from InboxAppCo/fix/mustCallCloseCrash
[Fix] "must call close()" crash
2016-09-16 14:08:20 +02:00
Naoyuki Kanezawa
2d463ad8b8 Merge pull request #51 from ekudel/for_upsource
proxy support
2016-09-16 13:55:00 +02:00
nkzawa
94d37278e6 UTF8Exception: remove the data property 2016-09-16 13:28:51 +02:00
Naoyuki Kanezawa
be5b254a04 Merge pull request #66 from wzurita/refactoring_cleanup_polling
Disconnecting after closing the stream/ reader.
2016-09-04 01:50:04 +09:00
wzurita
59586f7609 Refactoring the cleanup method so it is called after the stream/reader is closed. Fixes #65 2016-08-29 23:50:01 +02:00
Stefan Haacker
1c166b25d9 [Fix] "must call close()" crash 2016-07-26 11:12:55 -04:00
Dave Roberge
912dfa211b Close the web socket after sending a close frame.
Previously, the underlying socket was being closed with the cancel call.
Because the socket was closed, the close frame could never be sent.
2016-07-17 12:42:02 -04:00
Vachagan Balayan
f119063af7 changed EventThread to extend daemon property from parent thread 2016-07-01 14:55:22 +08:00
nkzawa
330bf99dc3 test: use TLSv1 for node 0.12 or higher 2016-06-13 21:40:04 +09:00
Erik Ogenvik
fc9a1c45dc Act on the same number.
Else we'll enter an infinite loop.
2016-05-19 09:48:54 +02:00
Eugene Kudelevsky
d4cc84d08e Simplify API: remove HttpConnectionProvider 2016-05-17 16:41:41 +03:00
Naoyuki Kanezawa
065d872cc1 Merge pull request #54 from surlemur/master
log exceptions thrown in async tasks
2016-05-15 03:31:29 +09:00
George Kankava
8bbddbe00a multiple code improvements: squid:S2293, squid:S1213, squid:S2185, squid:S1905, squid:S1226 2016-05-03 12:13:05 +04:00
Dominik Auf der Maur
e6daeaeb28 log exceptions thrown in async tasks 2016-04-26 15:17:59 +02:00
Naoyuki Kanezawa
732308bafe Merge pull request #47 from georgekankava/release/multiple-code-improvements-fix-1
Multiple code improvements: squid:S1118, squid:S1068
2016-02-24 17:28:22 +09:00
Naoyuki Kanezawa
50d4de4cbe Merge pull request #45 from georgekankava/release/local-variable-and-method-parameter-names-should-comply-with-a-naming-convention-fix-1
squid:S00117 - Local variable and method parameter names should comply with a naming convention
2016-02-24 17:24:15 +09:00
George Kankava
634e8ef153 Multile code improvements: squid:S1118, squid:S1068 2016-02-18 19:44:10 +04:00
Eugene Kudelevsky
a7849055e6 proxy support 2016-02-08 21:26:36 +03:00
George Kankava
0ecdde6a77 multiple code improvements fix 3 2016-02-02 21:45:59 +04:00
George Kankava
423d61715d Multiple code improvements 2 2016-02-01 23:50:56 +04:00