Commit Graph

7693 Commits

Author SHA1 Message Date
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
86eb4227b2 docs(examples): add example with traefik
Reference: https://doc.traefik.io/traefik/v2.0/
2021-01-31 23:47:23 +01:00
Damien Arrachequesne
be81a2ce6f chore: point towards the master branch for the CI badge 2021-01-28 14:17:28 +01:00
Damien Arrachequesne
0a63a17f63 refactor: remove unused line
In Socket.IO v2, the Socket `query` option was sent when connecting to
a custom namespace (but not for the main namespace).

This was fixed in Socket.IO v3 ([1]), so this line is now useless.

[1]: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/#Add-a-clear-distinction-between-the-Manager-query-option-and-the-Socket-query-option
2021-01-28 12:27:02 +01:00
Damien Arrachequesne
cf873fd831 docs(examples): update cluster examples to Socket.IO v3 2021-01-28 11:21:38 +01:00
Damien Arrachequesne
0d10e6131b docs(examples): update the nginx cluster example
Related: https://github.com/socketio/socket.io/discussions/3778

Reference: http://nginx.org/en/docs/http/ngx_http_upstream_module.html#hash
2021-01-28 10:52:26 +01:00
JPSO
10aafbbc16 ci: add Node.js 15 (#3765) 2021-01-20 22:34:51 +01:00
Hamdi Bayhan
f34cfca26d docs: fix broken link (#3759) 2021-01-17 22:10:37 +01:00
PrashoonB
d412e876b8 docs: add installation with yarn (#3757) 2021-01-15 22:20:04 +01:00
Damien Arrachequesne
f05a4a6f82 chore(release): 3.1.0
Diff: https://github.com/socketio/socket.io/compare/3.0.5...3.1.0
3.1.0
2021-01-15 02:21:54 +01:00
Damien Arrachequesne
5529f34aaf chore(release): 3.1.0
Diff: https://github.com/socketio/socket.io-client/compare/3.0.5...3.1.0
2021-01-15 02:15:57 +01:00
Damien Arrachequesne
5d9b4eb42b chore: bump socket.io-parser version
Diff: https://github.com/socketio/socket.io-parser/compare/4.0.3...4.0.4
2021-01-15 01:59:56 +01:00
Damien Arrachequesne
13e16b9b79 chore: bump engine.io-client version
Diff: https://github.com/socketio/engine.io-client/compare/4.0.6...4.1.0
2021-01-15 01:56:01 +01:00
Damien Arrachequesne
af1b23ca85 chore(release): 4.0.4
Diff: https://github.com/socketio/socket.io-parser/compare/4.0.3...4.0.4
2021-01-15 01:45:17 +01:00
Damien Arrachequesne
2c883f5d4e chore: bump socket.io-adapter version
Diff: https://github.com/socketio/socket.io-adapter/compare/2.0.3...2.1.0

Includes:

- add room events ([155fa63](155fa6333a))
- make rooms and sids public ([313c5a9](313c5a9fb6))
2021-01-15 01:41:37 +01:00
Damien Arrachequesne
1c220ddbf4 fix: allow integers as event names
This commit restores the possibility to use integers as event names,
which was possible in Socket.IO v2.
2021-01-15 01:38:03 +01:00
Damien Arrachequesne
c95ab42aef chore(release): 2.1.0
Diff: https://github.com/socketio/socket.io-adapter/compare/2.0.3...2.1.0
2021-01-15 01:30:02 +01:00
Damien Arrachequesne
155fa6333a feat: add room events
The adapter will now emit the following events:

- create-room (arg: room)
- delete-room (arg: room)
- join-room (args: room, sid)
- leave-room (args: room, sid)

Related: https://github.com/socketio/socket.io/issues/2897
2021-01-15 01:22:49 +01:00
Jakob Ackermann
161091dd4c feat: confirm a weak but matching ETag (#3485)
When handling compression at the proxy server level, the client receives a weak ETag.
Weak ETags are prefixed with `W/`, e.g. `W/"2.2.0"`.
Upon cache validation we should take care of these too.

Reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag
2021-01-15 01:04:55 +01:00
汪心禾 Wang, Xinhe
d52532b7be docs: add other client implementations (#3593)
Reference: https://socket.io/docs/#Other-client-implementations
2021-01-15 00:37:40 +01:00
Sergio Lenza
6b1d7901db docs(examples): Improve the chat example with more ES6 features (#3240) 2021-01-15 00:36:17 +01:00
EloniX-X
b55892ae80 docs: add run on repl.it badge to README (#3617) 2021-01-15 00:30:17 +01:00
Pablo Tejada
233650c222 feat(esm): export the Namespace and Socket class (#3699) 2021-01-15 00:28:20 +01:00
Damien Arrachequesne
313c5a9fb6 feat: make rooms and sids public
Related: https://github.com/socketio/socket.io-adapter/issues/63
2021-01-14 23:56:30 +01:00
Damien Arrachequesne
9925746c8e feat: add support for Socket.IO v2 clients
In order to ease the migration to Socket.IO v3, the Socket.IO server
can now communicate with v2 clients.

```js
const io = require("socket.io")({
  allowEIO3: true
});
```

This feature is disabled by default.
2021-01-14 23:38:24 +01:00
Damien Arrachequesne
e5b307c16d chore(release): 4.1.0
Diff: https://github.com/socketio/engine.io/compare/4.0.6...4.1.0
2021-01-14 01:47:14 +01:00
Damien Arrachequesne
663d326d18 feat: add support for v3.x clients
In order to ease the migration to Socket.IO v3, the Engine.IO server
can now communicate with v3.x clients.

```js
const eioServer = require("engine.io")(httpServer, {
  allowEIO3: true // false by default
});
```

If `allowEIO3` is false, the v3.x clients will now receive an HTTP 400
response ("Unsupported protocol version").

Note: the code of the v3 parser has been imported from [1] and
browser-related dependencies were removed.

[1]: https://github.com/socketio/engine.io-parser/tree/2.2.1

Related:

- https://github.com/socketio/engine.io-protocol/issues/35
- https://github.com/socketio/socket.io-protocol/issues/21
2021-01-14 01:44:52 +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
Mick Lawitzke
fe97243fab fix(typings): make Manager#opts public (#1437)
As stated in the [documentation][1], the query option can be set by
setting `socket.io.opts` but `opts` was private and readonly.

[1]: https://socket.io/docs/v3/client-api/#With-query-option
2021-01-11 22:47:28 +01:00
Damien Arrachequesne
4922e397f4 docs: points towards the website
The website is now much more stable, so there's no need to keep two
copies of the same content (which must be manually kept in sync).
2021-01-08 15:13:43 +01:00
Rohan Chougule
de8dffd252 refactor: strict type check in if expressions (#3744) 2021-01-08 14:58:37 +01:00
Damien Arrachequesne
f8a66fd11a chore(release): 3.0.5
Diff: https://github.com/socketio/socket.io/compare/3.0.4...3.0.5
3.0.5
2021-01-05 12:08:15 +01:00
Damien Arrachequesne
bcdd3bef85 chore(release): 3.0.5
Diff: https://github.com/socketio/socket.io-client/compare/3.0.4...3.0.5
2021-01-05 12:02:52 +01:00
Damien Arrachequesne
752dfe3b1e chore: bump debug version 2021-01-05 11:53:27 +01:00
Damien Arrachequesne
bf54327421 revert: restore the socket middleware functionality
This functionality was removed in [1] (included in 3.0.0), but
catch-all listeners and socket middleware features are complementary
rather than mutually exclusive.

The only difference with the previous implementation is that passing an
error to the `next` handler will create an error on the server-side,
and not on the client-side anymore.

```js
io.on("connection", (socket) => {

  socket.use(([ event, ...args ], next) => {
    next(new Error("stop"));
  });

  socket.on("error", (err) => {
    // to restore the previous behavior
    socket.emit("error", err);

    // or close the connection, depending on your use case
    socket.disconnect(true);
  });
});
```

This creates additional possibilities about custom error handlers, which
may be implemented in the future.

```js
// user-defined error handler
socket.use((err, [ event ], next) => {
  // either handle it
  socket.disconnect();

  // or forward the error to the default error handler
  next(err);
});

// default error handler
socket.use((err, _, next) => {
  socket.emit("error", err);
});
```

Related: https://github.com/socketio/socket.io/issues/3678

[1]: 5c73733985
2021-01-05 11:51:50 +01:00
Damien Arrachequesne
170b739f14 fix: properly clear timeout on connection failure
Related: https://github.com/socketio/socket.io/issues/3720
2021-01-05 11:51:08 +01:00
Damien Arrachequesne
cf9fc35836 chore: bump debug version 2021-01-05 11:46:06 +01:00
Damien Arrachequesne
53c73749a8 fix: emit a connect_error event upon connection failure
Related: https://github.com/socketio/socket.io/issues/3734
2021-01-05 11:42:54 +01:00
Damien Arrachequesne
444520d6cd chore(release): 4.0.3
Diff: https://github.com/socketio/socket.io-parser/compare/4.0.2...4.0.3
2021-01-05 11:26:13 +01:00
Damien Arrachequesne
b076dbb722 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
2021-01-05 11:24:49 +01:00
Damien Arrachequesne
7c380d38eb chore: bump debug version 2021-01-05 11:00:39 +01:00
Damien Arrachequesne
b83f89c901 fix(typings): make sendBuffer and receiveBuffer public
See also: https://socket.io/docs/v3/client-offline-behavior/#Buffered-events
2021-01-05 10:17:58 +01:00
Damien Arrachequesne
8c08c5d5c3 refactor: remove global polyfill from webpack config
Fixes https://github.com/socketio/socket.io-client/issues/1407
2021-01-05 10:15:27 +01:00
Damien Arrachequesne
9b621523ef chore(release): 4.0.6
Diff: https://github.com/socketio/engine.io/compare/4.0.5...4.0.6
2021-01-04 23:27: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
5a91253f21 chore: bump ws and debug versions 2021-01-04 23:03:49 +01:00