Commit Graph

24 Commits

Author SHA1 Message Date
Damien Arrachequesne
bc98bf1232 refactor: bump prettier to version 2.8.1
This major bump creates a lot of noise, but it is necessary for
prettier to be able to parse new syntax such as:

- typed imports: `import { type xxx } from ...`
- private attributes: `class A { #b; #c() {} }`
2023-01-10 15:22:57 +01:00
Damien Arrachequesne
535a01d889 ci: add Node.js 18 in the test matrix
A few notes:

- the certificates were recreated because Node.js 18 includes OpenSSL
v3, which has deprecated support for some legacy ciphers (like RC2)

- eiows currently fails to build on Node.js 18, so the tests are
temporarily skipped

See also: https://github.com/nodejs/Release
2022-11-20 00:20:30 +01:00
Damien Arrachequesne
35b6b505df test: replace "s" package by string interpolation 2021-11-08 08:17:25 +01:00
Damien Arrachequesne
271e2df94d feat: add an implementation based on uWebSockets.js
```js
const { App } = require("uWebSockets.js");
const { uServer } = require("engine.io");

const app = new App();
const server = new uServer();

server.attach(app);

app.listen(3000);
```

Reference: https://github.com/uNetworking/uWebSockets.js

Related: https://github.com/socketio/engine.io/issues/578
2021-11-02 22:46:09 +01:00
Damien Arrachequesne
fe5d97fc3d chore(release): 6.0.0
Diff: https://github.com/socketio/engine.io/compare/5.2.0...6.0.0
2021-10-08 16:12:32 +02:00
Damien Arrachequesne
c0d6eaa1ba chore: migrate to TypeScript
Related: https://github.com/socketio/engine.io/issues/510
2021-10-08 14:55:30 +02:00
Damien Arrachequesne
7096e98a02 feat: add a "connection_error" event
The "connection_error" event will be emitted when one of the following
errors occurs:

- Transport unknown
- Session ID unknown
- Bad handshake method
- Bad request
- Forbidden
- Unsupported protocol version

Syntax:

```js
server.on("connection_error", (err) => {
  console.log(err.req);		// the request object
  console.log(err.code);	// the error code, for example 1
  console.log(err.message);	// the error message, for example "Session ID unknown"
  console.log(err.context);     // some additional error context
});
```

Related:

- https://github.com/socketio/socket.io/issues/3819
- https://github.com/socketio/engine.io/issues/576
2021-04-30 13:04:28 +02:00
Damien Arrachequesne
edb734316f feat: remove dynamic require() with wsEngine
This change is necessary to get rid of:

> Critical dependency: the request of a dependency is an expression

when bundling the server with webpack.

BREAKING CHANGE: the syntax of the "wsEngine" option is updated

Before:

```js
const eioServer = require("engine.io")(httpServer, {
  wsEngine: "eiows"
});
```

After:

```js
const eioServer = require("engine.io")(httpServer, {
  wsEngine: require("eiows").Server
});
```

Related: https://github.com/socketio/engine.io/issues/609
2021-03-09 08:30:05 +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
f5efa1e02a refactor: use ES6 syntax for the tests 2020-12-07 10:57:28 +01:00
Damien Arrachequesne
33564b2391 refactor: use prettier to format code 2020-01-14 21:58:38 +01:00
Damien Arrachequesne
dd854a8803 [test] Use explicit versions for travis tests (#457) 2016-12-08 01:06:14 +01:00
Damien Arrachequesne
7c33b42153 [test] fix tests for NodeJS v7 (#441) 2016-11-03 01:28:01 +01:00
Diga Widyaprana
7cbdd5e5d9 [style] Add ESlint (#385) 2016-10-31 02:40:58 +01:00
Kim Min-Ho
e008ffeba5 [style] Fix some typos (#439) 2016-10-25 00:58:01 +02:00
Guillermo Rauch
8ede274e05 test: fix syntax, remove globals 2014-01-05 19:16:15 -03:00
Guillermo Rauch
dc8ceca3d1 test: clean up common 2012-10-04 09:07:37 -07:00
Guillermo Rauch
e4ca71c84e Fixed ambiguous requirement. 2012-03-03 19:05:05 -03:00
Guillermo Rauch
7784d48838 Fixed eio requirement to require lib-cov if needed. 2012-03-03 18:41:33 -03:00
Guillermo Rauch
3f3da53491 Added listen utilit for ephemeral ports listening & sprintf. 2012-01-14 09:41:10 -08:00
Guillermo Rauch
57c10d2265 Expose client globally to tests as eioc 2012-01-03 13:11:22 -08:00
Guillermo Rauch
28f7d4d715 Added instrumentation support for the client during tests. 2012-01-03 13:11:09 -08:00
Guillermo Rauch
c0286cea4e Expose eio and superagent to all tests. 2011-12-29 13:12:57 -05:00
Guillermo Rauch
0d339536e3 Added common test files 2011-12-21 18:02:10 -08:00