Commit Graph

1540 Commits

Author SHA1 Message Date
Damien Arrachequesne
08db7f62e4 ci: increase the build timeout
The CI sometimes fails after the 10 minutes timeout.
2021-07-30 09:13:02 +02:00
Damien Arrachequesne
c1713d1418 chore: revert zuul bump
The CI with the latest version of zuul (3.12.x) timeouts without any
logs.
2021-07-30 09:11:49 +02:00
Damien Arrachequesne
2de8b4ef97 refactor: remove forked xmlhttprequest-ssl
Our fork of the xmlhttprequest-ssl package, which was created for the
autoUnref feature (see [1]), is not needed anymore as our changes have
been merged upstream (see [2]).

[1]: 65516836b2
[2]: fd05315b41

Related: https://github.com/socketio/engine.io-client/issues/673
2021-07-13 09:10:27 +02:00
Damien Arrachequesne
9c79ba65f5 chore(release): 5.1.2
Diff: https://github.com/socketio/engine.io-client/compare/5.1.1...5.1.2
2021-06-24 08:24:07 +02:00
Damien Arrachequesne
589d3ad638 fix: emit ping when receiving a ping from the server
The "ping" event was forgotten when reversing the ping-pong mechanism
in [1]. It will now be properly emitted when receiving a ping from the
server.

[1]: 81d7171c6b

Related: https://github.com/socketio/socket.io-client/issues/1475
2021-06-23 00:44:06 +02:00
Damien Arrachequesne
2525f14888 chore: npm audit fix 2021-06-23 00:14:36 +02:00
Xiaoxin Lu
f30a10b7f4 fix(websocket): fix timer blocking writes (#670)
An immediate setTimeout was used to unblock the WebSocket write.
Unfortunately, this setTimeout can be throttled by browsers when the
tab is backgrounded.

This can lead to missed pong responses to server pings, which
eventually leads to disconnection.

Related: https://github.com/socketio/engine.io-client/issues/649
2021-06-22 23:58:27 +02:00
dependabot[bot]
52847fd958 chore: bump browserslist from 4.15.0 to 4.16.6 (#665)
Bumps [browserslist](https://github.com/browserslist/browserslist) from 4.15.0 to 4.16.6.
- [Release notes](https://github.com/browserslist/browserslist/releases)
- [Changelog](https://github.com/browserslist/browserslist/blob/main/CHANGELOG.md)
- [Commits](https://github.com/browserslist/browserslist/compare/4.15.0...4.16.6)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-03 16:41:35 +02:00
dependabot[bot]
3c9c8603fa chore: bump ws from 7.4.2 to 7.4.6 (#666)
Bumps [ws](https://github.com/websockets/ws) from 7.4.2 to 7.4.6.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/7.4.2...7.4.6)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-02 23:03:08 +02:00
Damien Arrachequesne
8bc9b3bb81 chore(release): 5.1.1
Diff: https://github.com/socketio/engine.io-client/compare/5.1.0...5.1.1
2021-05-11 08:34:14 +02:00
Damien Arrachequesne
bddd9928fc fix: fix JSONP transport on IE9
This fixes the following error:

> Unable to get value of the property 'readyState': object is null or undefined

Which was introduced in c46611ce44
2021-05-11 08:22:36 +02:00
Damien Arrachequesne
df6a54772d docs(changelog): include changelog for releases 3.5.2 & 4.1.4 2021-05-05 22:45:20 +02:00
Damien Arrachequesne
0acbe5fded chore(release): 5.1.0
Diff: https://github.com/socketio/engine.io-client/compare/5.0.1...5.1.0
2021-05-04 09:40:44 +02:00
Damien Arrachequesne
c46611ce44 refactor: remove "self" references 2021-05-04 09:28:21 +02:00
Damien Arrachequesne
dcb85e902d feat: add the "closeOnBeforeunload" option
Since [1], the socket is now closed when receiving the "beforeunload"
event in the browser.

This change was meant to fix a discrepancy between Chrome and Firefox
when the user reloads/closes a browser tab: Firefox would close the
connection (and emit a "disconnect" event, at the Socket.IO level), but
not Chrome (see [2]).

But it also closes the connection when there is another "beforeunload"
handler, for example when the user is prompted "are you sure you want
to leave this page?".

Note: calling "stopImmediatePropagation()" was a possible workaround:

```js
window.addEventListener('beforeunload', (event) => {
  event.preventDefault();
  event.stopImmediatePropagation();
  event.returnValue = 'are you sure you want to leave this page?';
});
```

This commit adds a "closeOnBeforeunload" option, which controls whether
a handler is registered for the "beforeunload" event.

Syntax:

```js
const socket = require('engine.io-client')('ws://localhost', {
  closeOnBeforeunload: false // defaults to true
});
```

[1]: ed48b5dc34
[2]: https://github.com/socketio/socket.io/issues/3639

Related:

- https://github.com/socketio/engine.io-client/issues/661
- https://github.com/socketio/engine.io-client/issues/658
- https://github.com/socketio/socket.io-client/issues/1451

Reference: https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
2021-05-04 08:45:09 +02:00
Damien Arrachequesne
9eeed5e0c0 chore(release): 5.0.1
Diff: https://github.com/socketio/engine.io-client/compare/5.0.0...5.0.1
2021-03-31 23:59:36 +02:00
Damien Arrachequesne
d291a4c9f6 fix: ignore packets when the transport is silently closed
In some cases, a "Transport not open" error could be thrown when the
transport was silently closed in the onbeforeunload event (added in
[1]).

To reproduce:

```js
window.addEventListener("unload", () => {
  socket.write("...");
});
```

[1]: ed48b5dc34

Related: https://github.com/socketio/socket.io/issues/3838
2021-03-31 23:53:09 +02:00
Damien Arrachequesne
fc5dc6b91e refactor: use ES6 syntax in tests 2021-03-31 11:35:12 +02:00
Damien Arrachequesne
14e81805ab chore(release): 5.0.0
The major bump is due to a breaking change on the server side.

Diff: https://github.com/socketio/engine.io-client/compare/4.1.2...5.0.0
2021-03-10 10:09:12 +01:00
Damien Arrachequesne
b8e06a8674 refactor: use globalObject "self" in webpack configuration 2021-03-10 10:05:36 +01:00
Damien Arrachequesne
65516836b2 feat: add autoUnref option
With autoUnref set to true (default: false), the Engine.IO client will
allow the program to exit if there is no other active timer/socket in
the event system.

Note: the 'xmlhttprequest-ssl' package has been copied in the contrib/
directory, until the change is merged upstream

Related: https://github.com/socketio/engine.io-client/issues/653
2021-03-03 10:12:40 +01:00
Damien Arrachequesne
9bf70c17bd docs(changelog): include changelog for release 3.5.1
Merged from the 3.5.x branch.
2021-03-02 09:45:18 +01:00
Damien Arrachequesne
c361bc691f feat: listen to the "offline" event
The connection will be closed once the "offline" event is emitted by
the browser, in order not to wait for the heartbeat mechanism to detect
the disconnection.

Reference: https://developer.mozilla.org/en-US/docs/Web/API/Window/offline_event

Related: https://github.com/socketio/socket.io-client/issues/1433
2021-03-02 09:24:21 +01:00
Damien Arrachequesne
6f7c89db76 chore(release): 4.1.2
Diff: https://github.com/socketio/engine.io-client/compare/4.1.1...4.1.2
2021-02-25 22:42:51 +01:00
Damien Arrachequesne
ed48b5dc34 fix: silently close the transport in the beforeunload hook
Related:

- https://github.com/socketio/socket.io/issues/3639
- https://github.com/socketio/socket.io/issues/3069
2021-02-25 00:32:18 +01:00
Damien Arrachequesne
76338d79fb refactor: use globalObject "this" in webpack configuration 2021-02-25 00:29:37 +01:00
Damien Arrachequesne
ee0a35d0e4 chore(release): 4.1.1
Diff: https://github.com/socketio/engine.io-client/compare/4.1.0...4.1.1
2021-02-02 09:59:44 +01:00
Damien Arrachequesne
e551fc082a chore: point towards the master branch for the CI badge
Reference: https://docs.github.com/en/actions/managing-workflow-runs/adding-a-workflow-status-badge#using-the-branch-parameter
2021-02-02 09:58:40 +01:00
Damien Arrachequesne
c95fdea833 fix: remove polyfill for process in the bundle
A polyfill for Node.js "process" was included in the final bundle.

Reference: https://webpack.js.org/configuration/node/
2021-02-02 09:52:57 +01:00
Damien Arrachequesne
63939e6ae2 chore(release): 4.1.0
Diff: https://github.com/socketio/engine.io-client/compare/4.0.6...4.1.0
2021-01-14 01:25:48 +01:00
Damien Arrachequesne
8ad533fc6e chore: ignore generated file 2021-01-14 01:22:46 +01:00
Damien Arrachequesne
d134feeaa6 feat: add missing ws options
Reference: https://github.com/websockets/ws/blob/master/doc/ws.md#new-websocketaddress-protocols-options

Related:

- https://github.com/socketio/engine.io-client/issues/574
- https://github.com/socketio/engine.io-client/issues/615
2021-01-14 01:19:25 +01:00
Damien Arrachequesne
2bd444ae9f chore(release): 4.0.6
Diff: https://github.com/socketio/engine.io-client/compare/4.0.5...4.0.6
2021-01-04 23:18:53 +01:00
Damien Arrachequesne
aeaf072b5e chore: bump ws and debug versions 2021-01-04 23:07:25 +01:00
Damien Arrachequesne
acb221688e chore: update GitHub issue templates 2020-12-30 10:31:10 +01:00
Damien Arrachequesne
ab8c746a73 docs(changelog): include changelog for release 3.5.0
Merged from the 3.5.x branch.
2020-12-30 09:55:05 +01:00
7006
70b3551503 style: fix Russian spelling (#650) 2020-12-30 08:16:01 +01:00
Damien Arrachequesne
afd25b4902 chore(release): 4.0.5
Diff: https://github.com/socketio/engine.io-client/compare/4.0.4...4.0.5
2020-12-07 11:08:13 +01:00
Damien Arrachequesne
5c9726ce68 docs: fix withCredentials default value 2020-12-07 10:59:43 +01:00
Damien Arrachequesne
587ccf3380 refactor: remove the policyPort option
This option was used by the flash-websocket transport.
2020-12-07 10:59:43 +01:00
Damien Arrachequesne
9146a577bc chore: bump dev dependencies 2020-12-07 10:35:49 +01:00
Damien Arrachequesne
20f7fe0363 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.

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

[1]: https://blog.travis-ci.com/2020-11-02-travis-ci-new-billing
2020-12-05 01:11:41 +01:00
Camilo Rodríguez
c22681542c refactor: avoid redeclaring const in xhr polling transport (#645) 2020-12-03 16:26:41 +01:00
Damien Arrachequesne
091a619405 chore(release): 4.0.4
Diff: https://github.com/socketio/engine.io-client/compare/4.0.3...4.0.4
2020-11-17 11:37:29 +01:00
Damien Arrachequesne
1c8cba8818 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).

This could lead to writes (POST requests) without "sid" query param,
which failed with:

```
{"code":2,"message":"Bad handshake method"}
```

Related:

- https://github.com/socketio/engine.io-client/issues/636
- https://github.com/socketio/socket.io-client/issues/1390
2020-11-17 11:19:07 +01:00
Damien Arrachequesne
4873a237f1 fix: restore the cherry-picking of the WebSocket options
The previous commit ([1]) makes the Engine.IO tests with Node.js SSL
options fail.

[1]: 177b95fe46
2020-11-17 11:15:53 +01:00
Damien Arrachequesne
8228a43335 chore(release): 4.0.3
Diff: https://github.com/socketio/engine.io-client/compare/4.0.2...4.0.3
2020-11-17 09:25:41 +01:00
Damien Arrachequesne
89cb771cf0 refactor: remove binary handling for the polling transport (bis)
The `supportsBinary` attribute and the `forceBase64` option are kept
untouched, though they are not used by the polling transport, which
now always converts the payloads to base64.

Related: https://github.com/socketio/socket.io-client/issues/1391
2020-11-17 09:19:28 +01:00
Damien Arrachequesne
177b95fe46 fix(react-native): exclude the localAddress option
React Native only supports the "headers" option in the WebSocket constructor.

Related: https://github.com/socketio/socket.io-client/issues/1397
2020-11-16 23:17:21 +01:00
Damien Arrachequesne
ccb99e3718 fix(react-native): add a default value for the withCredentials option
The undefined value breaks React Native on Android with a rather cryptic error message:

```
Attempt to invoke virtual method 'boolean java.lang.Boolean.booleanValue() on a null object reference
```

This bug was introduced by [1].

[1]: 5f47a50ee5

Related: https://github.com/socketio/socket.io-client/issues/1403
2020-11-16 23:17:21 +01:00