Commit Graph

340 Commits

Author SHA1 Message Date
Damien Arrachequesne
70220b5333 chore: bump engine.io-client dependency
Diff: https://github.com/socketio/engine.io-client/compare/5.0.1...5.1.0
2021-05-11 09:12:12 +02:00
Damien Arrachequesne
6279065209 chore(release): 4.0.2
Diff: https://github.com/socketio/socket.io-client/compare/4.0.1...4.0.2
2021-05-06 14:31:00 +02:00
Damien Arrachequesne
2edf0f308c chore(release): 4.0.1
Diff: https://github.com/socketio/socket.io-client/compare/4.0.0...4.0.1
2021-04-01 01:07:04 +02:00
Damien Arrachequesne
d28cde7afc chore(release): 4.0.0
The major bump is due to some breaking changes on the server side.

Diff: https://github.com/socketio/socket.io-client/compare/3.1.2...4.0.0
2021-03-10 12:25:27 +01:00
KC Erb
6abfa1fa4c feat: add autoUnref option
With autoUnref set to true (default: false), the Socket.IO client will
allow the program to exit if there is no other active timer/socket in
the event system.

```js
const socket = io({
  autoUnref: true
});
```

Note: this option only applies to Node.js clients.

Related: https://github.com/socketio/socket.io-client/issues/1446
2021-03-10 12:16:12 +01:00
Damien Arrachequesne
59023657a0 feat: add support for typed events
Syntax:

```ts
interface ServerToClientEvents {
  "my-event": (a: number, b: string, c: number[]) => void;
}

interface ClientToServerEvents {
  hello: (message: string) => void;
}

const socket: Socket<ServerToClientEvents, ClientToServerEvents> = io();

socket.emit("hello", "world");

socket.on("my-event", (a, b, c) => {
  // ...
});
```

The events are not typed by default (inferred as any), so this change
is backward compatible.

Related: https://github.com/socketio/socket.io/issues/3742
2021-03-10 01:24:56 +01:00
Damien Arrachequesne
78ec5a6e43 chore(release): 3.1.2
Diff: https://github.com/socketio/socket.io-client/compare/3.1.1...3.1.2
2021-02-26 01:10:30 +01:00
Damien Arrachequesne
311c5d14c3 chore(release): 3.1.1
Diff: https://github.com/socketio/socket.io-client/compare/3.1.0...3.1.1
2021-02-03 22:36:17 +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
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
cf9fc35836 chore: bump debug version 2021-01-05 11:46:06 +01:00
david-fong
7bc7a7b624 refactor: switch to native javascript bind (#1423)
The polyfill for the bind() method was necessary for IE6/7/8, which we
do not support anymore.

Related: https://caniuse.com/mdn-javascript_builtins_function_bind
2020-12-11 11:55:57 +01:00
Damien Arrachequesne
085cd6c56d chore(release): 3.0.4
Diff: https://github.com/socketio/socket.io-client/compare/3.0.3...3.0.4
2020-12-07 11:43:11 +01:00
david-fong
226b491846 refactor(typings): make typing information more specific (#1418) 2020-12-07 09:06:57 +01:00
Damien Arrachequesne
66e4fdf2e6 chore(release): 3.0.3
Diff: https://github.com/socketio/socket.io-client/compare/3.0.2...3.0.3
2020-11-19 01:01:33 +01:00
Damien Arrachequesne
e2a4c56709 chore: cleanup dist folder before compilation 2020-11-19 00:59:42 +01:00
Damien Arrachequesne
a883e3238e chore(release): 3.0.2
Diff: https://github.com/socketio/socket.io-client/compare/3.0.1...3.0.2
2020-11-18 00:00:42 +01:00
Damien Arrachequesne
969d5c95f8 chore(release): 3.0.1
Diff: https://github.com/socketio/socket.io-client/compare/3.0.0...3.0.1
2020-11-09 10:27:33 +01:00
Damien Arrachequesne
b7e07ba633 chore(release): 3.0.0
Diff: https://github.com/socketio/socket.io-client/compare/2.3.1...3.0.0
2020-11-05 22:06:25 +01:00
Damien Arrachequesne
ffa280450d chore(release): 3.0.0-rc4
Diff: https://github.com/socketio/socket.io-client/compare/3.0.0-rc3...3.0.0-rc4
2020-10-30 23:02:06 +01:00
Damien Arrachequesne
a9127cee83 chore(release): 3.0.0-rc3
Diff: https://github.com/socketio/socket.io-client/compare/3.0.0-rc2...3.0.0-rc3
2020-10-27 00:41:32 +01:00
Damien Arrachequesne
13e1db7c94 refactor: rename ERROR to CONNECT_ERROR
The meaning is not modified: this packet type is still used by the
server when the connection to a namespace is refused.

Breaking change: the Socket instance will now emit a "connect_error"
event instead of "error" (which is not a reserved event anymore)

```js
// before
socket.on("error", () => {});

// after
socket.on("connect_error", () => {});
```
2020-10-26 10:04:05 +01:00
Damien Arrachequesne
71d60480af feat: add bundle with msgpack parser
Pros:

- events with binary content are sent as 1 WebSocket frame (instead of 2 with the default parser)
- payloads with lots of numbers should be smaller

Cons:

- no IE9 support (https://caniuse.com/mdn-javascript_builtins_arraybuffer)
- a slightly bigger bundle size (61.1 vs 59.9 KB)

Source: https://github.com/darrachequesne/socket.io-msgpack-parser
2020-10-25 22:47:31 +01:00
Damien Arrachequesne
b600e78f71 chore(release): 3.0.0-rc2
Diff: https://github.com/socketio/socket.io-client/compare/3.0.0-rc1...3.0.0-rc2
2020-10-15 13:00:43 +02:00
Damien Arrachequesne
178909471a feat: move binary detection back to the parser
See 285e7cd0d8

Breaking change: the Socket#binary() method is removed, as this use
case is now covered by the ability to provide your own parser.
2020-10-15 10:37:06 +02:00
Damien Arrachequesne
c7998d5446 refactor: add Manager and Socket typings 2020-10-14 22:59:58 +02:00
Damien Arrachequesne
2c7c230153 chore: publish the wrapper.mjs file 2020-10-14 01:51:30 +02:00
Damien Arrachequesne
a66473f93a chore: use socketio GitHub organization 2020-10-14 01:49:06 +02:00
Damien Arrachequesne
946a9f008c chore: fix test script 2020-10-14 00:00:02 +02:00
Damien Arrachequesne
a838ff1fc8 chore(release): 3.0.0-rc1
Diff: https://github.com/socketio/socket.io-client/compare/2.3.1...3.0.0-rc1
2020-10-13 23:35:22 +02:00
Damien Arrachequesne
b68f816323 chore: bump debug 2020-10-13 23:24:41 +02:00
Damien Arrachequesne
cbabb0308e feat: add ES6 module export
- with `{ "type": "commonjs" }` in the package.json file

```js
const io = require("socket.io-client");

const socket = io("/");
```

- with `{ "type": "module" }`

```js
import io from "socket.io-client";

const socket = io("/");

// or
import { Manager } from "socket.io-client";

const manager = new Manager();
const socket = manager.socket("/");
```

Related: https://nodejs.org/api/packages.html#packages_dual_commonjs_es_module_packages
2020-10-13 22:53:53 +02:00
Damien Arrachequesne
249e0bef90 feat: remove the implicit connection to the default namespace
Related: 09b6f23339
2020-10-08 02:04:03 +02:00
Damien Arrachequesne
be8c3141bd chore: include Engine.IO client v4
The ping-pong mechanism has been reverted (server now sends a ping and
expects a pong from the client), so we cannot compute the latency like
we did in previous versions.

Release notes: https://github.com/socketio/engine.io-client/releases/tag/4.0.0
2020-10-06 22:50:52 +02:00
Damien Arrachequesne
f2f4a4c7c7 chore: point towards the develop branch of the server
The package-lock.json file is temporarily removed in order to include
the latest commits to the server and make the tests pass.
2020-10-06 22:41:17 +02:00
Damien Arrachequesne
429846b0a1 chore: bump socket.io-parser
Breaking change:

- the encode() method is now synchronous

Please note that the exchange [protocol][1] is left untouched and thus
stays in version 4.

Diff: https://github.com/socketio/socket.io-parser/compare/3.4.1...4.0.0

[1] https://github.com/socketio/socket.io-protocol
2020-10-06 01:20:12 +02:00
Damien Arrachequesne
cab895f477 refactor: use prettier to format tests 2020-10-06 00:21:14 +02:00
Damien Arrachequesne
697bea2d81 refactor: migrate to TypeScript 2020-10-06 00:21:14 +02:00
Damien Arrachequesne
3c11eb9d2e refactor: remove gulp from the build
Plain npm scripts should be sufficient for our use case.
2020-10-05 15:48:22 +02:00
Damien Arrachequesne
4631ed6ab3 chore(release): 2.3.1
Diff: https://github.com/socketio/socket.io-client/compare/2.3.0...2.3.1
2020-09-30 18:32:33 +02:00
Damien Arrachequesne
b570025a79 chore: bump engine.io-client and downgrade debug
The newer versions need to be transpiled to ES5, so we'll rollback for
now as it breaks IE11.

We'll have to find a way to provide the users who bundle the Engine.IO
(or Socket.IO) client (with webpack for example) with a source code
which does not include debug (or document the usage of
webpack-remove-debug [1]).

[1] https://github.com/johngodley/webpack-remove-debug
2020-09-30 02:26:29 +02:00
Damien Arrachequesne
1fb1b78020 chore: remove unused dependencies
- base64-arraybuffer => dev
- has-cors => dev
- object-component => removed
2020-09-30 02:24:16 +02:00
Damien Arrachequesne
f4a4d89f15 chore: update package-lock.json file
Following previous commit, the lock file was not up-to-date.
2020-09-30 00:20:59 +02:00
rookieKing
3c1d860420 chore: bump component-emitter dependency (#1376)
Subscribing/unsubscribing for a lot of different event types could lead
to a memory leak.

See aa2e57acc7

Diff: https://github.com/component/emitter/compare/1.2.1...1.3.0
2020-09-30 00:13:12 +02:00
Damien Arrachequesne
661f1e7fac [chore] Release 2.3.0
Diff: https://github.com/socketio/socket.io-client/compare/2.2.0...2.3.0
2019-09-20 12:22:41 +02:00
Damien Arrachequesne
71d7b79965 [chore] Bump engine.io-client to version 3.4.0
Also includes the bump of the debug dependency.

Diff: https://github.com/socketio/engine.io-client/compare/3.3.1...3.4.0
2019-09-20 12:02:21 +02:00
Damien Arrachequesne
3020e455ab [chore] Release 2.2.0 2018-11-29 00:15:03 +01:00
Damien Arrachequesne
06e9a4ca26 [chore] Bump dependencies
- engine.io-client: https://github.com/socketio/engine.io-client/compare/3.2.0...3.3.1
- socket.io-parser: https://github.com/socketio/socket.io-parser/compare/3.2.0..3.3.0
2018-11-28 22:51:53 +01:00