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: jhonrputra/socket.io
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: socketio/socket.io
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.

Commits on Oct 8, 2021

  1. Copy the full SHA
    4974e90 View commit details

Commits on Oct 11, 2021

  1. Copy the full SHA
    eb5fdbd View commit details

Commits on Oct 13, 2021

  1. Copy the full SHA
    60edecb View commit details

Commits on Oct 14, 2021

  1. Copy the full SHA
    95810aa View commit details

Commits on Oct 16, 2021

  1. fix: fix server attachment (socketio#4127)

    The check excluded an HTTPS server from being properly attached.
    
    Related: socketio#4124
    HexaField authored Oct 16, 2021
    Copy the full SHA
    0ef2a4d View commit details
  2. Copy the full SHA
    ccc5ec3 View commit details

Commits on Oct 24, 2021

  1. Copy the full SHA
    44e20ba View commit details
  2. fix: fix race condition in dynamic namespaces (socketio#4137)

    Using an async operation with `io.use()` could lead to the creation of
    several instances of a same namespace, each of them overriding the
    previous one.
    
    Example:
    
    ```js
    io.use(async (nsp, auth, next) => {
      await anOperationThatTakesSomeTime();
      next();
    });
    ```
    
    Related: socketio#4136
    sebamarynissen authored and darrachequesne committed Oct 24, 2021
    Copy the full SHA
    9d86397 View commit details

Commits on Nov 8, 2021

  1. Copy the full SHA
    ed8483d View commit details
  2. feat: add type information to socket.data (socketio#4159)

    Usage:
    
    ```js
    interface SocketData {
      name: string;
      age: number;
    }
    
    const io = new Server<ClientToServerEvents, ServerToClientEvents, InterServerEvents, SocketData>();
    
    io.on("connection", (socket) => {
      socket.data.name = "john";
      socket.data.age = 42;
    });
    ```
    backmeupplz authored Nov 8, 2021
    Copy the full SHA
    fe8730c View commit details

Commits on Nov 12, 2021

  1. feat: add an implementation based on uWebSockets.js

    Usage:
    
    ```js
    const { App } = require("uWebSockets.js");
    const { Server } = require("socket.io");
    
    const app = new App();
    const server = new Server();
    
    server.attachApp(app);
    
    app.listen(3000);
    ```
    
    The Adapter prototype is updated so we can benefit from the publish
    functionality of uWebSockets.js, so this will apply to all adapters
    extending the default adapter.
    
    Reference: https://github.com/uNetworking/uWebSockets.js
    
    Related:
    
    - socketio#3601
    - socketio/engine.io#578
    darrachequesne committed Nov 12, 2021
    Copy the full SHA
    c0d8c5a View commit details
  2. fix: only set 'connected' to true after middleware execution

    The Socket instance is only considered connected when the "connection"
    event is emitted, and not during the middleware(s) execution.
    
    ```js
    io.use((socket, next) => {
      console.log(socket.connected); // prints "false"
      next();
    });
    
    io.on("connection", (socket) => {
      console.log(socket.connected); // prints "true"
    });
    ```
    
    Related: socketio#4129
    darrachequesne committed Nov 12, 2021
    Copy the full SHA
    02b0f73 View commit details

Commits on Nov 16, 2021

  1. Copy the full SHA
    2da8210 View commit details
  2. test: fix flaky test

    `srv.close()` only closes the underlying HTTP server, but this does not
    terminate the existing WebSocket connections.
    
    Reference: https://nodejs.org/api/http.html#serverclosecallback
    darrachequesne committed Nov 16, 2021
    Copy the full SHA
    b7213e7 View commit details
  3. feat: add timeout feature

    Usage:
    
    ```js
    socket.timeout(5000).emit("my-event", (err) => {
      if (err) {
        // the client did not acknowledge the event in the given delay
      }
    });
    ```
    darrachequesne committed Nov 16, 2021
    Copy the full SHA
    f0ed42f View commit details

Commits on Nov 18, 2021

  1. fix: prevent double ack when emitting with a timeout

    The ack was not properly removed upon timeout, and could be called
    twice.
    
    Related: socketio@f0ed42f
    darrachequesne committed Nov 18, 2021
    Copy the full SHA
    b839a3b View commit details
  2. Copy the full SHA
    0f11c47 View commit details

Commits on Nov 24, 2021

  1. docs: simplify nginx cluster example

    - remove useless Dockerfile
    - clean format
    - migrate to @socket.io/redis-adapter
    darrachequesne committed Nov 24, 2021
    Copy the full SHA
    2071a66 View commit details

Commits on Nov 30, 2021

  1. Copy the full SHA
    e5897dd View commit details
  2. Copy the full SHA
    7a70f63 View commit details

Commits on Dec 16, 2021

  1. docs: fix basic crud example

    Related: socketio#4213
    darrachequesne committed Dec 16, 2021
    Copy the full SHA
    c196689 View commit details

Commits on Dec 28, 2021

  1. chore: add types to exports field to be compatible with nodenext modu…

    …le resolution (socketio#4228)
    
    See [1] for detail, in `nodenext` module resolution it requires a
    `types` field in `exports` with full filename including extension.
    
    [1]: microsoft/TypeScript#46770 (comment)
    otakustay authored Dec 28, 2021
    Copy the full SHA
    51784d0 View commit details

Commits on Jan 4, 2022

  1. fix(typings): pass SocketData type to custom namespaces (socketio#4233

    )
    
    The `SocketData` type was only available on the main namespace.
    
    Related: socketio#4229
    See also: socketio@fe8730c
    OrkhanAlikhanov authored Jan 4, 2022
    Copy the full SHA
    f2b8de7 View commit details

Commits on Jan 5, 2022

  1. test: fix flaky tests

    darrachequesne committed Jan 5, 2022
    Copy the full SHA
    c840bad View commit details
  2. refactor(typings): export Event type (socketio#4215)

    So that it can be used by the end users:
    
    ```ts
    const myMiddleware = ([eventName, ...args]: Event, next: (err?: Error) => void) => {
      console.log(eventName); // inferred as string
      next();
    }
    
    io.on("connection", (socket) => {
      socket.use(myMiddleware);
    });
    ```
    shayanYousefi authored and darrachequesne committed Jan 5, 2022
    Copy the full SHA
    fc82e44 View commit details
  3. Copy the full SHA
    3bf5d92 View commit details

Commits on Jan 6, 2022

  1. Copy the full SHA
    770ee59 View commit details
  2. Copy the full SHA
    c82a4bd View commit details
  3. chore: revert to lockfile v1

    Updating to v2 fails in the CI on Node.js 12 & 14 with the following
    error:
    
    > npm ERR! Error while executing:
    > npm ERR! /usr/bin/git ls-remote -h -t ssh://git@github.com/uNetworking/uWebSockets.js.git
    > npm ERR!
    > npm ERR! Warning: Permanently added the RSA host key for IP address '140.82.113.3' to the list of known hosts.
    > npm ERR! git@github.com: Permission denied (publickey).
    > npm ERR! fatal: Could not read from remote repository.
    > npm ERR!
    > npm ERR! Please make sure you have the correct access rights
    > npm ERR! and the repository exists.
    > npm ERR!
    > npm ERR! exited with error code: 128
    
    So we will revert the change for now.
    darrachequesne committed Jan 6, 2022
    Copy the full SHA
    aa5312a View commit details

Commits on Jan 10, 2022

  1. docs: remove broken badges

    Related: socketio#4242
    darrachequesne committed Jan 10, 2022
    Copy the full SHA
    af54565 View commit details
  2. Copy the full SHA
    37b6d8f View commit details

Commits on Jan 25, 2022

  1. Copy the full SHA
    02c87a8 View commit details
  2. Copy the full SHA
    2f96438 View commit details

Commits on Jan 12, 2023

  1. docs(examples): update docker-compose.yml (socketio#4594)

    Updated docker compose to be in line with current practices.
    
    Reference: https://docs.docker.com/compose/
    abriejenny authored Jan 12, 2023
    Copy the full SHA
    c2858e9 View commit details

Commits on Oct 10, 2023

  1. Copy the full SHA
    f3ea96e View commit details
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
name: Bug report
about: Create a report to help us improve
title: ''
labels: 'bug'
labels: 'to triage'
assignees: ''

---
28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -24,3 +24,31 @@ jobs:
- run: npm test
env:
CI: true

build-examples:
runs-on: ubuntu-latest
timeout-minutes: 10

strategy:
fail-fast: false
matrix:
example:
- custom-parsers
- typescript
- webpack-build
- webpack-build-server

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20

- name: Build ${{ matrix.example }}
run: |
cd examples/${{ matrix.example }}
npm install
npm run build
56 changes: 56 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,59 @@
## [4.4.1](https://github.com/socketio/socket.io/compare/4.4.0...4.4.1) (2022-01-06)


### Bug Fixes

* **types:** make `RemoteSocket.data` type safe ([#4234](https://github.com/socketio/socket.io/issues/4234)) ([770ee59](https://github.com/socketio/socket.io/commit/770ee5949fb47c2556876c622f06c862573657d6))
* **types:** pass `SocketData` type to custom namespaces ([#4233](https://github.com/socketio/socket.io/issues/4233)) ([f2b8de7](https://github.com/socketio/socket.io/commit/f2b8de71919e1b4d3e57f15a459972c1d1064787))



# [4.4.0](https://github.com/socketio/socket.io/compare/4.3.2...4.4.0) (2021-11-18)


### Bug Fixes

* only set 'connected' to true after middleware execution ([02b0f73](https://github.com/socketio/socket.io/commit/02b0f73e2c64b09c72c5fbf7dc5f059557bdbe50))


### Features

* add an implementation based on uWebSockets.js ([c0d8c5a](https://github.com/socketio/socket.io/commit/c0d8c5ab234d0d2bef0d0dec472973cc9662f647))
* add timeout feature ([f0ed42f](https://github.com/socketio/socket.io/commit/f0ed42f18cabef20ad976aeec37077b6bf3837a5))
* add type information to `socket.data` ([#4159](https://github.com/socketio/socket.io/issues/4159)) ([fe8730c](https://github.com/socketio/socket.io/commit/fe8730ca0f15bc92d5de81cf934c89c76d6af329))



## [4.3.2](https://github.com/socketio/socket.io/compare/4.3.1...4.3.2) (2021-11-08)


### Bug Fixes

* fix race condition in dynamic namespaces ([#4137](https://github.com/socketio/socket.io/issues/4137)) ([9d86397](https://github.com/socketio/socket.io/commit/9d86397243bcbb5775a29d96e5ef03e17148a8e7))


## [4.3.1](https://github.com/socketio/socket.io/compare/4.3.0...4.3.1) (2021-10-16)


### Bug Fixes

* fix server attachment ([#4127](https://github.com/socketio/socket.io/issues/4127)) ([0ef2a4d](https://github.com/socketio/socket.io/commit/0ef2a4d02c9350aff163df9cb61aece89c4dac0f))


# [4.3.0](https://github.com/socketio/socket.io/compare/4.2.0...4.3.0) (2021-10-14)


### Bug Fixes

* **typings:** add name field to cookie option ([#4099](https://github.com/socketio/socket.io/issues/4099)) ([033c5d3](https://github.com/socketio/socket.io/commit/033c5d399a2b985afad32c1e4b0c16d764e248cd))
* send volatile packets with binary attachments ([dc81fcf](https://github.com/socketio/socket.io/commit/dc81fcf461cfdbb5b34b1a5a96b84373754047d5))


### Features

* serve ESM bundle ([60edecb](https://github.com/socketio/socket.io/commit/60edecb3bd33801803cdcba0aefbafa381a2abb3))


# [4.2.0](https://github.com/socketio/socket.io/compare/4.1.3...4.2.0) (2021-08-30)


12 changes: 9 additions & 3 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -2,8 +2,6 @@
[![Run on Repl.it](https://repl.it/badge/github/socketio/socket.io)](https://replit.com/@socketio/socketio-minimal-example)
[![Backers on Open Collective](https://opencollective.com/socketio/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/socketio/sponsors/badge.svg)](#sponsors)
[![Build Status](https://github.com/socketio/socket.io/workflows/CI/badge.svg)](https://github.com/socketio/socket.io/actions)
[![Dependency Status](https://david-dm.org/socketio/socket.io.svg)](https://david-dm.org/socketio/socket.io)
[![devDependency Status](https://david-dm.org/socketio/socket.io/dev-status.svg)](https://david-dm.org/socketio/socket.io#info=devDependencies)
[![NPM version](https://badge.fury.io/js/socket.io.svg)](https://www.npmjs.com/package/socket.io)
![Downloads](https://img.shields.io/npm/dm/socket.io.svg?style=flat)
[![](https://slackin-socketio.now.sh/badge.svg)](https://slackin-socketio.now.sh)
@@ -22,7 +20,7 @@ Some implementations in other languages are also available:
- [Swift](https://github.com/socketio/socket.io-client-swift)
- [Dart](https://github.com/rikulo/socket.io-client-dart)
- [Python](https://github.com/miguelgrinberg/python-socketio)
- [.Net](https://github.com/Quobject/SocketIoClientDotNet)
- [.NET](https://github.com/doghappy/socket.io-client-csharp)

Its main features are:

@@ -115,6 +113,14 @@ io.on('connection', client => { ... });
io.listen(3000);
```

### Module syntax

```js
import { Server } from "socket.io";
const io = new Server(server);
io.listen(3000);
```

### In conjunction with Express

Starting with **3.0**, express applications have become request handler
Loading