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
587ccf3380
refactor: remove the policyPort option
...
This option was used by the flash-websocket transport.
2020-12-07 10:59:43 +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
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
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
Damien Arrachequesne
ec3f677e92
refactor: remove binary handling for the polling transport
...
Since Engine.IO v4, the binary payloads are always encoded as base64
with the polling transport.
See https://github.com/socketio/engine.io-protocol#difference-between-v3-and-v4
Possibly related: https://github.com/socketio/socket.io-client/issues/1391
2020-11-08 02:12:11 +01:00
Damien Arrachequesne
bc9d6c1669
refactor: fix typo
...
Closes https://github.com/socketio/socket.io-client/pull/1354
2020-09-30 01:46:50 +02:00
Damien Arrachequesne
8440a57f76
chore: bump engine.io-parser version
...
See also: https://github.com/socketio/engine.io-protocol#difference-between-v3-and-v4
Release: https://github.com/socketio/engine.io-parser/releases/tag/4.0.0
Diff: https://github.com/socketio/engine.io-parser/compare/2.2.0...4.0.0
2020-09-09 00:02:24 +02:00
Damien Arrachequesne
2f5c948abe
fix(react-native): restrict the list of options for the WebSocket object
...
Only 'headers' and 'localAddress' options are supported by the
WebSocket implementation in React Native.
The following message was printed to the console:
> Unrecognized WebSocket connection option(s) `agent`, `perMessageDeflate`, `pfx`, `key`, `passphrase`, `cert`, `ca`, `ciphers`, `rejectUnauthorized`. Did you mean to put these under `headers`?
Reference: https://reactnative.dev/docs/network.html#websocket-support
2020-05-25 07:34:17 +02:00
Damien Arrachequesne
3f3a6f9914
fix: use globalThis polyfill instead of self/global ( #634 )
...
In order to fix the "self is not defined" issues in Android 8 and React
Native.
Fixes https://github.com/socketio/engine.io-client/issues/611 , https://github.com/socketio/engine.io-client/issues/626
Closes https://github.com/socketio/engine.io-client/pull/627
2020-04-16 16:08:37 +02:00
Chris West (Faux)
27fa6949f3
refactor: remove indexof dependency
...
This is a polyfill for indexOf(), which we use literally everywhere else.
2020-04-16 10:06:44 +02:00
Damien Arrachequesne
7c7f1a9fe2
fix: properly assign options when creating the transport
...
The query attribute was overwritten, due to the order of arguments in
the assignment. The bug was introduced in the refactor (5f47a50 ).
2020-02-12 08:14:51 +01:00
Damien Arrachequesne
5f47a50ee5
refactor: refactor the handling of the options
2020-02-11 23:33:34 +01:00
Damien Arrachequesne
81d7171c6b
feat: reverse the ping-pong mechanism
...
The ping packets will now be sent by the server, because the timers set
in the browsers are not reliable enough. We suspect that a lot of
timeout problems came from timers being delayed on the client-side.
Breaking change: v3.x clients will not be able to connect anymore (they
will send a ping packet and timeout while waiting for a pong packet).
Related: https://github.com/socketio/engine.io/issues/312
2020-02-04 12:29:37 +01:00
Damien Arrachequesne
08aff9487f
refactor: use prettier to format code
2020-01-14 22:58:35 +01:00
Damien Arrachequesne
0fcc5417ac
refactor: migrate to ES6 syntax
2020-01-10 07:29:26 +01:00
Damien Arrachequesne
11dc4f3a56
chore: migrate to webpack 4
...
Breaking change: the output bundle will now be found in the dist/ folder.
2020-01-10 07:27:02 +01:00
Christopher
fd7fff252d
[fix] Ensure valid status is passed to error handler ( #622 )
...
Closes https://github.com/socketio/engine.io-client/issues/621
2019-09-13 11:59:51 +02:00
Nubami SQReder
226626921d
[feat] Support extra charset info in Content-Type header ( #619 )
...
XHR Polling failed to make handshake with server that adds charset info into Content-Type header.
Closes https://github.com/socketio/engine.io-client/issues/618
2019-09-13 11:58:24 +02:00
Jake Barnes
2847411dd0
[feat] Add withCredentials option ( #614 )
...
withCredentials was always set to true, despite the browser default being false, and can now be overridden.
Closes https://github.com/socketio/engine.io-client/issues/495
2019-09-13 11:56:36 +02:00
Szymon Lesisz
0eeaa7a927
[fix] fix NodeWebSocket declaration ( #613 )
...
NodeWebSocket was be required ONLY if global variables self and WebSocket were not defined.
Closes https://github.com/socketio/engine.io-client/issues/609
2019-09-13 11:53:59 +02:00
Ben James
1ec53d424d
[fix] Fix Websocket implementation in React Native ( #607 )
...
As `self` is undefined in React Native.
2019-01-20 22:34:30 +01:00
Damien Arrachequesne
66b9e4a186
[fix] fix JSONP transport in Node.js environment
...
The commit 99bcc62 resulted in `window is not defined` errors.
2018-11-19 22:12:20 +01:00
Nubami SQReder
f62fca4b05
[fix] Trigger xhr polling transport unload handler on 'pagehide' or 'unload' instead of 'beforeunload' ( #604 )
...
...to prevent broke connection on cancelled beforeunload event
Fixes #603
2018-11-19 13:11:45 +01:00
Damien Arrachequesne
99bcc622cb
[fix] Remove any reference to the global variable
...
Related: https://github.com/socketio/socket.io-client/issues/1166
2018-11-07 22:40:39 +01:00
Craig Thayer
26e9329050
[feat] Detect React-Native environment and use all websocket features ( #591 )
...
React-Native provides a Websocket object that is more functionally aligned with the Node.js websocket than the browser websocket.
It has the same constructor signature as the Node.js websocket and can support extraHeaders and protocols.
This PR will detect when the engine.io-client is running in React-Native, call the proper Websocket constructor, and enable support for extraHeaders.
2018-11-02 08:09:02 +01:00
Thomas Hunkapiller
4349b648d4
[fix] Fix UTF-8 encoding in Firefox WebWorker ( #596 )
2018-03-09 13:01:02 +01:00
Damien Arrachequesne
8cde767f94
[test] Update travis configuration ( #594 )
2018-02-28 01:02:49 +01:00
Damien Arrachequesne
64ce48046f
fix: use try/catch when setting xhr.responseType ( #592 )
...
Some XHR implementations (like Firefox WebWorker, react-native and some Android 4.x versions) throw
an exception when setting xhr.responseType = 'arraybuffer' when xhr.readyState === 2 (which is
perfectly valid, spec-wise).
That commit fixes that behaviour by reverting some of the changes from
https://github.com/socketio/engine.io-client/pull/562 for those implementations.
Fixes #589
Closes #590
2018-02-18 11:35:00 +01:00
Damien Arrachequesne
42501c658e
[revert] [refactor] Remove usuless indexof dependency ( #582 )
...
This reverts commit 6043c49e91 .
2017-10-11 07:33:55 +02:00
Damien Arrachequesne
6043c49e91
[refactor] Remove usuless indexof dependency ( #582 )
2017-10-08 10:00:09 +02:00
Matt Grande
0b26bc3fd8
[fix] Remove parsejson dependency ( #580 )
...
Related: https://nodesecurity.io/advisories/528 .
2017-09-27 22:33:04 +02:00
Damien Arrachequesne
7aad0d6da1
[chore] Bump engine.io-parser to version 2.1.0 ( #565 )
2017-04-24 23:50:37 +02:00
Tom Atkinson
3e0334645b
[refactor] Set responseType based on 'Content-Type' header ( #562 )
2017-04-24 13:04:26 +02:00
Damien Arrachequesne
beb7090318
[fix] Default rejectUnauthorized to true ( #558 )
2017-03-24 13:00:58 +01:00
Damien Arrachequesne
56bf176bc6
[chore] Bump engine.io-parser to version 2.0.2 ( #555 )
2017-03-22 07:24:53 +01:00
stormbkk87
151976594e
[feat] Allow to set the protocols for the websocket transport ( #546 )
...
Some WebSocket implementations require the protocols parameter or will
fail connection.
2017-03-06 13:07:19 +01:00
Denis Yaremov
22c28a24b7
[fix] Fix extraHeaders option in browser ( #536 )
2017-02-01 14:46:07 +01:00
Damien Arrachequesne
b1baf8d998
[feature] Allow extraHeaders to be set for browser clients in XHR requests ( #519 )
2016-12-30 17:08:38 +01:00
Damien Arrachequesne
c01b9a8560
[feature] Add support for per transport options ( #518 )
2016-12-30 16:46:36 +01:00
magicdawn@qq.com
9cfc626bf7
[feature] add localAddress option ( #487 )
2016-10-31 01:34:19 +01:00
Daniel Schlosser
8be5864169
[feature] Added flag forceNode to override the normal behavior of prefering Browser based implementations. ( #469 )
2016-10-30 23:49:55 +01:00
Ben Ripkens
3427e744e1
Enable definition of timeouts for xhr-polling
...
The definition of timeouts is desirable to cancel long outstanding
requests automatically via browser mechanisms. Specifically, it can
happen that lots of pending XHR requests are scheduled, but are never
purged by the browser due to the lack of a timeout definition.
2016-10-30 22:06:00 +01:00
Jarmo Isotalo
a38551f45f
Fixed regression creating connection over wss from node
2016-10-28 04:14:52 +03:00
Jarmo Isotalo
9abcb152da
Fixed regression creating connection over https from node
2016-10-28 02:58:42 +03:00
Luigi Pinca
7acae3db15
[fix] Obfuscate ActiveXObject occurrences ( #509 )
...
Some corporate firewalls/proxies such as Blue Coat prevent JavaScript
files from being downloaded if they contain the word "ActiveX".
2016-10-24 01:00:45 +02:00
besaplla
618758543e
[fix] onPacket now emits data on 'closing' state as well ( #484 )
2016-10-23 09:15:11 +02:00