Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: socketio/socket.io-client
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: de2ccff492b37b0fb83124f83c7614d413588037
Choose a base ref
...
head repository: socketio/socket.io-client
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: b7e07ba633ceb9c1dc94cc894c10b9bfca536c7a
Choose a head ref

Commits on Oct 5, 2020

  1. docs: remove reference to JSON3

    The `json3` dependency, previously used for compatibility with IE6/7,
    was removed in [1] and included in `socket.io-parser@3.0.0` and
    `socket.io-client@2.0.0` ([2]).
    
    The slim build now only removes the debug dependency (~3KB min+gzip).
    
    [1] socketio/socket.io-parser@e39f5a8#diff-b9cfc7f2cdf78a7f4b91a753d10865a2
    [2] ff4cb3e#diff-b9cfc7f2cdf78a7f4b91a753d10865a2R28
    darrachequesne committed Oct 5, 2020
    Copy the full SHA
    f08b933 View commit details
  2. refactor: remove gulp from the build

    Plain npm scripts should be sufficient for our use case.
    darrachequesne committed Oct 5, 2020
    Copy the full SHA
    3c11eb9 View commit details
  3. test: add Node.js 12 and 14 in the build matrix

    Node.js 8 is removed, as it is now EOL.
    darrachequesne committed Oct 5, 2020
    Copy the full SHA
    003cb38 View commit details
  4. Copy the full SHA
    697bea2 View commit details
  5. Copy the full SHA
    cab895f View commit details
  6. 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: socketio/socket.io-parser@3.4.1...4.0.0
    
    [1] https://github.com/socketio/socket.io-protocol
    darrachequesne committed Oct 5, 2020
    Copy the full SHA
    429846b View commit details

Commits on Oct 6, 2020

  1. 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.
    darrachequesne committed Oct 6, 2020
    Copy the full SHA
    f2f4a4c View commit details
  2. 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
    darrachequesne committed Oct 6, 2020
    Copy the full SHA
    be8c314 View commit details

Commits on Oct 8, 2020

  1. Copy the full SHA
    249e0be View commit details
  2. Copy the full SHA
    bbe94ad View commit details

Commits on Oct 12, 2020

  1. Copy the full SHA
    c07b91d View commit details
  2. refactor: remove the packetBuffer array

    The parser#encode() method is now synchronous, so the packetBuffer
    array is useless.
    darrachequesne committed Oct 12, 2020
    Copy the full SHA
    6cd2e4e View commit details
  3. feat: split the events of the Manager and Socket

    Previously, most of the events emitted by the Manager were also emitted
    by the Socket instances, but it was somehow misleading for the end
    users because they don't have the same meaning:
    
    - Manager: the state of the low-level connection (with connection and reconnection events)
    - Socket: the state of the connection to the Namespace (only 'connect', 'disconnect' and 'error')
    
    For example, the `reconnect` event:
    
    ```js
    socket.on("reconnect", () => {
      console.log(socket.connected); // might be false, which is a bit surprising
    });
    ```
    
    Breaking change: the Socket instance will no longer forward the events
    of its Manager
    
    Those events can still be accessed on the Manager instance though:
    
    ```js
    socket.io.on("reconnect", () => {
      // ...
    });
    ```
    darrachequesne committed Oct 12, 2020
    Copy the full SHA
    132f8ec View commit details
  4. feat: throw upon reserved event names

    These events cannot be used by the end users, because they are part of
    the Socket.IO public API, so using them will now throw an error
    explicitly.
    
    Related: socketio/socket.io@f7ed81e
    darrachequesne committed Oct 12, 2020
    Copy the full SHA
    6494f61 View commit details
  5. refactor: remove the 'connecting' event

    This event was added in 4195680
    
    But it does not convey the information that the Socket is actually
    sending a CONNECT packet to the server. It should maybe be moved to the
    Socket#onopen() method, but let's remove it for now as it is not
    documented anywhere.
    darrachequesne committed Oct 12, 2020
    Copy the full SHA
    b60e909 View commit details
  6. refactor: remove the 'connect_timeout' event

    The 'connect_timeout' event is now merged with the 'connect_error'
    event, and will now emit an Error object instead of a plain string.
    darrachequesne committed Oct 12, 2020
    Copy the full SHA
    e826992 View commit details

Commits on Oct 13, 2020

  1. 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
    darrachequesne committed Oct 13, 2020
    Copy the full SHA
    cbabb03 View commit details
  2. chore: bump debug

    darrachequesne committed Oct 13, 2020
    Copy the full SHA
    b68f816 View commit details
  3. Copy the full SHA
    a838ff1 View commit details
  4. chore: fix test script

    darrachequesne committed Oct 13, 2020
    Copy the full SHA
    946a9f0 View commit details
  5. Copy the full SHA
    a66473f View commit details
  6. Copy the full SHA
    2c7c230 View commit details

Commits on Oct 14, 2020

  1. Copy the full SHA
    c7998d5 View commit details

Commits on Oct 15, 2020

  1. feat: move binary detection back to the parser

    See socketio/socket.io-parser@285e7cd
    
    Breaking change: the Socket#binary() method is removed, as this use
    case is now covered by the ability to provide your own parser.
    darrachequesne committed Oct 15, 2020
    Copy the full SHA
    1789094 View commit details
  2. Copy the full SHA
    b600e78 View commit details

Commits on Oct 17, 2020

  1. feat: add volatile events

    A volatile packet will be dropped if:
    
    - the socket is not connected
    - the low-level transport is not ready (for example, a HTTP POST request is already pending)
    
    Syntax:
    
    ```js
    socket.volatile.emit("volatile event", "might or might not be sent");
    ```
    darrachequesne committed Oct 17, 2020
    Copy the full SHA
    7ddad2c View commit details
  2. Copy the full SHA
    f3cbe98 View commit details

Commits on Oct 25, 2020

  1. 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
    darrachequesne committed Oct 25, 2020
    Copy the full SHA
    71d6048 View commit details

Commits on Oct 26, 2020

  1. feat: add support for catch-all listeners

    Inspired from EventEmitter2 [1]
    
    The API is similar to the one on the server-side:
    
    ```js
    socket.onAny((event, ...args) => {});
    
    socket.prependAny((event, ...args) => {});
    
    socket.offAny(); // remove all listeners
    
    socket.offAny(listener);
    
    const listeners = socket.listenersAny();
    ```
    
    [1]: https://github.com/EventEmitter2/EventEmitter2
    darrachequesne committed Oct 26, 2020
    Copy the full SHA
    55f464f View commit details
  2. 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", () => {});
    ```
    darrachequesne committed Oct 26, 2020
    Copy the full SHA
    13e1db7 View commit details
  3. Copy the full SHA
    a9127ce View commit details

Commits on Oct 27, 2020

  1. refactor: rework of the Manager events

    - rename "connect_error" to "error"
    - remove "reconnecting" (duplicate of "reconnect_attempt")
    
    The updated list of events emitted by the Manager:
    
    - open:                successful (re)connection
    - error:               (re)connection failure (previously: "connect_error") or error after a successful connection
    - close:               disconnection
    
    - ping:                ping packet
    - packet:              data packet
    
    - reconnect_attempt:   reconnection attempt (previously: "reconnect_attempt" & "reconnecting")
    - reconnect:           successful reconnection
    - reconnect_error:     reconnection failure
    - reconnect_failed:    reconnection failure after all attempts
    
    For reference, the Socket instance emits the following events:
    
    - connect:             successful connection to a Namespace
    - connect_error:       connection failure
    - disconnect:          disconnection
    darrachequesne committed Oct 27, 2020
    Copy the full SHA
    969debe View commit details

Commits on Oct 30, 2020

  1. Copy the full SHA
    0939395 View commit details
  2. Copy the full SHA
    ffa2804 View commit details

Commits on Nov 5, 2020

  1. chore(release): 3.0.0

    darrachequesne committed Nov 5, 2020
    Copy the full SHA
    b7e07ba View commit details
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/node_modules
/coverage
build/
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
language: node_js
node_js:
- '8'
- '10'
- '12'
- '14'
sudo: false
git:
depth: 1
122 changes: 121 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,123 @@
# [3.0.0](https://github.com/socketio/socket.io-client/compare/2.3.1...3.0.0) (2020-11-05)

### Code Refactoring

* rename ERROR to CONNECT_ERROR ([13e1db7](https://github.com/socketio/socket.io-client/commit/13e1db7c94291c583d843beaa9e06ee041ae4f26))

### Features

* emit an Error object upon middleware error ([0939395](https://github.com/socketio/socket.io-client/commit/09393952e3397a0c71f239ea983f8ec1623b7c21))
* add bundle with msgpack parser ([71d6048](https://github.com/socketio/socket.io-client/commit/71d60480af9ea06d22792540dafb18a76e9362e7))
* add support for catch-all listeners ([55f464f](https://github.com/socketio/socket.io-client/commit/55f464f59ed523fa1c1948ec10752bfdf808262d))
* add volatile events ([7ddad2c](https://github.com/socketio/socket.io-client/commit/7ddad2c09dea0391b20378ef03b40040f0230d3e))
* move binary detection back to the parser ([1789094](https://github.com/socketio/socket.io-client/commit/178909471a3dd232e71cba83b729b4cc66f1412f))
* add ES6 module export ([cbabb03](https://github.com/socketio/socket.io-client/commit/cbabb0308ef4f7d302654755e08fe2103b9f22c8))
* do not reuse the Engine.IO id ([bbe94ad](https://github.com/socketio/socket.io-client/commit/bbe94adb822a306c6272e977d394e3e203cae25d))
* remove the implicit connection to the default namespace ([249e0be](https://github.com/socketio/socket.io-client/commit/249e0bef9071e7afd785485961c4eef0094254e8))
* split the events of the Manager and Socket ([132f8ec](https://github.com/socketio/socket.io-client/commit/132f8ec918a596eec872aee0c61d4ce63714c400))
* throw upon reserved event names ([6494f61](https://github.com/socketio/socket.io-client/commit/6494f61be0d38d267d77c30ea4f43941f97b1bc0))

### BREAKING CHANGES

* 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", () => {});
```

* the Socket#binary() method is removed, as this use case is now covered by the ability to provide your own parser.

* the Socket instance will no longer forward the events of its Manager

Those events can still be accessed on the Manager instance though:

```js
socket.io.on("reconnect", () => {
// ...
});
```

# [3.0.0-rc4](https://github.com/socketio/socket.io-client/compare/3.0.0-rc3...3.0.0-rc4) (2020-10-30)


### Features

* emit an Error object upon middleware error ([0939395](https://github.com/socketio/socket.io-client/commit/09393952e3397a0c71f239ea983f8ec1623b7c21))



# [3.0.0-rc3](https://github.com/socketio/socket.io-client/compare/3.0.0-rc2...3.0.0-rc3) (2020-10-26)


### Code Refactoring

* rename ERROR to CONNECT_ERROR ([13e1db7](https://github.com/socketio/socket.io-client/commit/13e1db7c94291c583d843beaa9e06ee041ae4f26))


### Features

* add bundle with msgpack parser ([71d6048](https://github.com/socketio/socket.io-client/commit/71d60480af9ea06d22792540dafb18a76e9362e7))
* add support for catch-all listeners ([55f464f](https://github.com/socketio/socket.io-client/commit/55f464f59ed523fa1c1948ec10752bfdf808262d))
* add volatile events ([7ddad2c](https://github.com/socketio/socket.io-client/commit/7ddad2c09dea0391b20378ef03b40040f0230d3e))


### BREAKING CHANGES

* 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", () => {});
```



# [3.0.0-rc2](https://github.com/socketio/socket.io-client/compare/3.0.0-rc1...3.0.0-rc2) (2020-10-15)


### Features

* move binary detection back to the parser ([1789094](https://github.com/socketio/socket.io-client/commit/178909471a3dd232e71cba83b729b4cc66f1412f))


### BREAKING CHANGES

* the Socket#binary() method is removed, as this use case is now covered by the ability to provide your own parser.



# [3.0.0-rc1](https://github.com/socketio/socket.io-client/compare/2.3.1...3.0.0-rc1) (2020-10-13)


### Features

* add ES6 module export ([cbabb03](https://github.com/socketio/socket.io-client/commit/cbabb0308ef4f7d302654755e08fe2103b9f22c8))
* do not reuse the Engine.IO id ([bbe94ad](https://github.com/socketio/socket.io-client/commit/bbe94adb822a306c6272e977d394e3e203cae25d))
* remove the implicit connection to the default namespace ([249e0be](https://github.com/socketio/socket.io-client/commit/249e0bef9071e7afd785485961c4eef0094254e8))
* split the events of the Manager and Socket ([132f8ec](https://github.com/socketio/socket.io-client/commit/132f8ec918a596eec872aee0c61d4ce63714c400))
* throw upon reserved event names ([6494f61](https://github.com/socketio/socket.io-client/commit/6494f61be0d38d267d77c30ea4f43941f97b1bc0))


### BREAKING CHANGES

* the Socket instance will no longer forward the events of its Manager

Those events can still be accessed on the Manager instance though:

```js
socket.io.on("reconnect", () => {
// ...
});
```


## [2.3.1](https://github.com/socketio/socket.io-client/compare/2.3.0...2.3.1) (2020-09-30)

The `debug` dependency has been reverted to `~3.1.0`, as the newer versions contains ES6 syntax which breaks in IE
@@ -11,5 +131,5 @@ plugin.

### Bug Fixes

* fix reconnection after opening socket asynchronously ([#1253](https://github.com/socketio/socket.io-client/issues/1253)) ([050108b](https://github.com/Automattic/socket.io-client/commit/050108b2281effda086b197cf174ee2e8e1aad79))
* fix reconnection after opening socket asynchronously ([#1253](https://github.com/socketio/socket.io-client/issues/1253)) ([050108b](https://github.com/socketio/socket.io-client/commit/050108b2281effda086b197cf174ee2e8e1aad79))

20 changes: 0 additions & 20 deletions Makefile

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ import io from 'socket.io-client';
const socket = io();
```

A slim build (without `JSON3`, a JSON polyfill for IE6/IE7, and `debug`) is also available: `socket.io.slim.js`.
A slim build (without [debug](https://github.com/visionmedia/debug)) is also available: `socket.io.slim.js`.

Socket.IO is compatible with [browserify](http://browserify.org/) and [webpack](https://webpack.js.org/) (see example [there](https://github.com/socketio/socket.io/tree/2.0.3/examples/webpack-build)).

Loading