Skip to content

Commit

Permalink
feat: add support for v3.x clients
Browse files Browse the repository at this point in the history
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:

- socketio/engine.io-protocol#35
- socketio/socket.io-protocol#21
  • Loading branch information
darrachequesne committed Jan 14, 2021
1 parent 9b62152 commit 663d326
Show file tree
Hide file tree
Showing 17 changed files with 1,013 additions and 66 deletions.
1 change: 1 addition & 0 deletions .prettierignore
@@ -0,0 +1 @@
lib/parser-v3/
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -252,6 +252,7 @@ to a single process.
- `wsEngine` (`String`): what WebSocket server implementation to use. Specified module must conform to the `ws` interface (see [ws module api docs](https://github.com/websockets/ws/blob/master/doc/ws.md)). Default value is `ws`. An alternative c++ addon is also available by installing `uws` module.
- `cors` (`Object`): the options that will be forwarded to the cors module. See [there](https://github.com/expressjs/cors#configuration-options) for all available options. Defaults to no CORS allowed.
- `initialPacket` (`Object`): an optional packet which will be concatenated to the handshake packet emitted by Engine.IO.
- `allowEIO3` (`Boolean`): whether to support v3 Engine.IO clients (defaults to `false`)
- `close`
- Closes all clients
- **Returns** `Server` for chaining
Expand Down

0 comments on commit 663d326

Please sign in to comment.