Commit Graph

247 Commits

Author SHA1 Message Date
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
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
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
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
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
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
beb7090318 [fix] Default rejectUnauthorized to true (#558) 2017-03-24 13:00:58 +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
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
besaplla
618758543e [fix] onPacket now emits data on 'closing' state as well (#484) 2016-10-23 09:15:11 +02:00
Tom Atkinson
b18f5b16df [perf] Add all properties to the socket in the constructor (#488) 2016-10-20 18:29:32 +02:00
Marshall Thompson
6b2b3bdaaa [chore] Use more-specific imports for StealJS compatibility (#467)
This allows browser loaders like StealJS to load this package without showing any errors or warnings in the console (since you the only way to check if a file exists from the browser it to request it, node-style folder assumptions can't be made without potential 404s.)

The package works fine with the StealJS build tools, since they're node based, but this lets allows it to work with the browser version.
2016-10-20 18:10:30 +02:00
Damien Arrachequesne
67ac4b7e1d Revert "default rejectUnauthorized to true" (#496)
This reverts commit 2c55b278a4, which breaks websocket transport under node v0.10 (#494).
2016-10-05 07:06:38 +02:00
Guillermo Rauch
2c55b278a4 default rejectUnauthorized to true 2016-03-30 08:30:14 -07:00
Diga Widyaprana
e2930f8aac Eslint manual fix 2016-03-01 00:41:08 +08:00
Diga Widyaprana
fd90acf4b6 Eslint autofix 2016-02-29 20:43:08 +08:00
nkzawa
1096ca6f61 fix ipv6 support and add tests 2015-12-02 17:59:11 +09:00
hell
54f020ec1a ipv6 url support 2015-12-02 15:54:17 +09:00
nkzawa
f848c0db6c remove compress option from control packets 2015-12-01 15:36:29 +09:00
nkzawa
cc8200fd21 threshold for permessage-deflate 2015-12-01 15:31:31 +09:00
Guillermo Rauch
d6d4ec22fa socket: remove duplicate declaration (fixes #434) 2015-11-19 09:26:34 -08:00
Foghost
5ffe4478fb fix rejectUnauthorized bug
fix bug even I set rejectUnauthorized=false it also throw err 'unable to verify the first certificate'
2015-06-02 17:53:43 +08:00
Guillermo Rauch
67ca376946 Merge branch 'master' of github.com:Automattic/engine.io-client 2015-05-27 12:59:43 -07:00
Guillermo Rauch
6ac9ac438a socket: clean up buffers right after close event, not on a different tick 2015-05-27 12:58:48 -07:00
Guillermo Rauch
54680e6bcc change the semantics of the write callback for polling transports. fire upon flush, not drain 2015-05-27 12:57:03 -07:00
Luigi Pinca
f9d1becfba socket: fix host parsing for IPv6 URLs 2015-05-02 15:17:13 +02:00
Guillermo Rauch
4f87aae6ee socket: handle parser errors appropriately 2015-04-08 08:32:02 -07:00
Guillermo Rauch
40de4b1cc4 style 2015-04-08 08:29:22 -07:00
Guillermo Rauch
d31a3931ae Merge pull request #379 from adrai/master
introduce extraHeaders (cookies)
2015-04-06 14:17:57 -07:00
Guillermo Rauch
fb7c1984e8 expose ping and pong events 2015-04-05 15:46:30 -07:00
Adriano Raiano
ed697edae6 do not special case cookies, introduce extraHeaders 2015-03-23 21:50:10 +01:00
Adriano Raiano
73970be23e introduce cookies 2015-03-13 16:17:12 +01:00
Naoyuki Kanezawa
f0096f6cbd Merge branch 'master' into compression
Conflicts:
	package.json
2015-01-22 03:56:03 +09:00
Roman Shtylman
92e08eee01 fix reference to this (typo from self commit) 2015-01-11 16:59:55 -08:00
Guillermo Rauch
e3fe9a2f44 Merge pull request #366 from Automattic/fix-default-port
fix default port detection when host is specified
2015-01-11 16:33:12 -08:00
Roman Shtylman
bfc48ec4ad fix default port detection when host is specified
This fixes an issue when a full url is specified (i.e.
http://service.com) the port would be the port from the page and not the
uri string. This is easily exposed if using external engine.io servers
on a page served up by localhost:3000 or similar from a development
page.
2015-01-11 16:32:35 -08:00
Guillermo Rauch
d0e8643d05 Revert "migrate this usage to self to help with client side minification"
This reverts commit d725d91db2.
2015-01-11 15:59:43 -08:00
Roman Shtylman
d725d91db2 migrate this usage to self to help with client side minification
`this` cannot be effectively minified but using a local self allows for
local minifcation.
2015-01-11 15:51:35 -08:00
Naoyuki Kanezawa
f6bf9f807f support permessage-deflate 2015-01-06 03:20:08 +09:00
Tony Kovanen
f2a0d3b528 Add rest of the ssl related options found in https.request. 2014-11-24 04:57:51 -03:00