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
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: [email protected]
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: [email protected]
Choose a head ref
  • 14 commits
  • 53 files changed
  • 2 contributors

Commits on Sep 21, 2024

  1. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    darrachequesne Damien Arrachequesne
    Copy the full SHA
    d4cb375 View commit details
  2. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    darrachequesne Damien Arrachequesne
    Copy the full SHA
    2b60df1 View commit details
  3. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    darrachequesne Damien Arrachequesne
    Copy the full SHA
    4a0555c View commit details
  4. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    darrachequesne Damien Arrachequesne
    Copy the full SHA
    d0fc720 View commit details

Commits on Oct 9, 2024

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    88efd44 View commit details
  2. ci: ignore tests when publishing to npm (bis)

    `tags-ignore` seems to disable the workflow in all cases.
    darrachequesne committed Oct 9, 2024

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    darrachequesne Damien Arrachequesne
    Copy the full SHA
    a5d2368 View commit details
  3. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    darrachequesne Damien Arrachequesne
    Copy the full SHA
    9b80ab4 View commit details

Commits on Oct 19, 2024

  1. fix(eio-client/types): remove ws type from .d.ts file

    Before this change, the following error would be thrown when compiling
    with TypeScript:
    
    ```
    node_modules/engine.io-client/build/esm/transports/websocket.node.d.ts:12:101 - error TS1340: Module 'ws' does not refer to a type, but is used as a type here. Did you mean 'typeof import('ws')'?
    
    12     createSocket(uri: string, protocols: string | string[] | undefined, opts: Record<string, any>): import("ws");
                                                                                                           ~~~~~~~~~~~~
    ```
    
    This behavior was introduced in [1], included in version `6.6.0`.
    
    The return type is forced as `any`, so that the `@types/ws` dependency
    is optional.
    
    [1]: f4d898e
    
    Related: #5202
    darrachequesne committed Oct 19, 2024

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    darrachequesne Damien Arrachequesne
    Copy the full SHA
    175a2c5 View commit details

Commits on Oct 21, 2024

  1. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    darrachequesne Damien Arrachequesne
    Copy the full SHA
    3b68658 View commit details
  2. ci: use Node.js 22

    darrachequesne committed Oct 21, 2024

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    darrachequesne Damien Arrachequesne
    Copy the full SHA
    d4b3dde View commit details
  3. fix(eio-client): prevent infinite loop with Node.js built-in WebSocket

    Related: #5194
    darrachequesne committed Oct 21, 2024

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    darrachequesne Damien Arrachequesne
    Copy the full SHA
    4865f2e View commit details

Commits on Oct 22, 2024

  1. fix(sio-client): do not mangle the "_placeholder" attribute

    The "_placeholder" attribute is used when sending binary data, and was
    incorrectly mangled (converted to a random short property, like "it",
    to reduce the bundle size).
    
    This bug was introduced in [1], included in `[email protected]`.
    
    [1]: 7085f0e
    
    Related: #5215
    darrachequesne committed Oct 22, 2024

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    darrachequesne Damien Arrachequesne
    Copy the full SHA
    ca9e994 View commit details

Commits on Oct 23, 2024

  1. docs(nuxt): update example with latest version

    Related: #5208
    
    [skip ci]
    darrachequesne committed Oct 23, 2024

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    darrachequesne Damien Arrachequesne
    Copy the full SHA
    4ca6ddb View commit details
  2. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    darrachequesne Damien Arrachequesne
    Copy the full SHA
    029e010 View commit details
Showing with 7,578 additions and 6,002 deletions.
  1. +2 −0 .github/workflows/build-examples.yml
  2. +2 −0 .github/workflows/ci-browser.yml
  3. +7 −0 .github/workflows/ci.yml
  4. +11 −10 examples/nuxt-example/server/plugins/socket.io.ts
  5. +30 −0 examples/typescript-client-example/cjs/client.ts
  6. +17 −0 examples/typescript-client-example/cjs/package.json
  7. +9 −0 examples/typescript-client-example/cjs/tsconfig.json
  8. +30 −0 examples/typescript-client-example/esm/client.ts
  9. +17 −0 examples/typescript-client-example/esm/package.json
  10. +9 −0 examples/typescript-client-example/esm/tsconfig.json
  11. +373 −24 package-lock.json
  12. +2 −1 package.json
  13. +16 −0 packages/engine.io-client/CHANGELOG.md
  14. +2 −2 packages/engine.io-client/dist/engine.io.esm.min.js
  15. +1 −1 packages/engine.io-client/dist/engine.io.esm.min.js.map
  16. +2 −1 packages/engine.io-client/dist/engine.io.js
  17. +1 −1 packages/engine.io-client/dist/engine.io.js.map
  18. +2 −2 packages/engine.io-client/dist/engine.io.min.js
  19. +1 −1 packages/engine.io-client/dist/engine.io.min.js.map
  20. +1 −1 packages/engine.io-client/lib/transports/websocket.node.ts
  21. +1 −0 packages/engine.io-client/lib/transports/websocket.ts
  22. +2 −1 packages/engine.io-client/package.json
  23. +13 −0 packages/engine.io-client/test/connection.js
  24. +1 −3 packages/engine.io-client/test/index.js
  25. +8 −0 packages/engine.io-client/test/support/env.js
  26. +12 −3 packages/engine.io-client/test/transport.js
  27. +5 −7 packages/engine.io-client/test/webtransport.mjs
  28. +1 −1 packages/engine.io-parser/lib/decodePacket.ts
  29. +30 −0 packages/engine.io/CHANGELOG.md
  30. +2 −2 packages/engine.io/package.json
  31. +5 −0 packages/engine.io/test/common.js
  32. +5 −7 packages/engine.io/test/webtransport.mjs
  33. +83 −0 packages/socket.io-client/CHANGELOG.md
  34. +2 −2 packages/socket.io-client/dist/socket.io.esm.min.js
  35. +1 −1 packages/socket.io-client/dist/socket.io.esm.min.js.map
  36. +3,394 −2,924 packages/socket.io-client/dist/socket.io.js
  37. +1 −1 packages/socket.io-client/dist/socket.io.js.map
  38. +2 −2 packages/socket.io-client/dist/socket.io.min.js
  39. +1 −1 packages/socket.io-client/dist/socket.io.min.js.map
  40. +2 −2 packages/socket.io-client/dist/socket.io.msgpack.min.js
  41. +1 −1 packages/socket.io-client/dist/socket.io.msgpack.min.js.map
  42. +2 −2 packages/socket.io-client/package.json
  43. +1 −0 packages/socket.io-client/support/rollup.config.umd.js
  44. +63 −63 packages/socket.io/CHANGELOG.md
  45. +2 −2 packages/socket.io/client-dist/socket.io.esm.min.js
  46. +1 −1 packages/socket.io/client-dist/socket.io.esm.min.js.map
  47. +3,394 −2,924 packages/socket.io/client-dist/socket.io.js
  48. +1 −1 packages/socket.io/client-dist/socket.io.js.map
  49. +2 −2 packages/socket.io/client-dist/socket.io.min.js
  50. +1 −1 packages/socket.io/client-dist/socket.io.min.js.map
  51. +2 −2 packages/socket.io/client-dist/socket.io.msgpack.min.js
  52. +1 −1 packages/socket.io/client-dist/socket.io.msgpack.min.js.map
  53. +1 −1 packages/socket.io/package.json
2 changes: 2 additions & 0 deletions .github/workflows/build-examples.yml
Original file line number Diff line number Diff line change
@@ -19,6 +19,8 @@ jobs:
- custom-parsers
- typescript-example/cjs
- typescript-example/esm
- typescript-client-example/cjs
- typescript-client-example/esm
- webpack-build
- webpack-build-server
- basic-crud-application/angular-client
2 changes: 2 additions & 0 deletions .github/workflows/ci-browser.yml
Original file line number Diff line number Diff line change
@@ -2,6 +2,8 @@ name: CI (browser)

on:
push:
branches:
- '**'
paths:
- 'packages/engine.io-parser/**'
- 'packages/engine.io-client/**'
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -2,6 +2,8 @@ name: CI

on:
push:
branches:
- '**'
pull_request:
schedule:
- cron: '0 0 * * 0'
@@ -20,6 +22,7 @@ jobs:
node-version:
- 18
- 20
- 22

services:
redis:
@@ -57,3 +60,7 @@ jobs:
- name: Run tests with fetch instead of XHR (engine.io-client)
run: npm run test:node-fetch --workspace=engine.io-client
if: ${{ matrix.node-version == '18' }}

- name: Run tests with Node.js native WebSocket (engine.io-client)
run: npm run test:node-builtin-ws --workspace=engine.io-client
if: ${{ matrix.node-version == '22' }}
21 changes: 11 additions & 10 deletions examples/nuxt-example/server/plugins/socket.io.ts
Original file line number Diff line number Diff line change
@@ -20,17 +20,18 @@ export default defineNitroPlugin((nitroApp: NitroApp) => {
},
websocket: {
open(peer) {
const nodeContext = peer.ctx.node;
const req = nodeContext.req;
// crossws >= 0.3.0
// @ts-expect-error private method and property
engine.prepare(peer._internal.nodeReq);
// @ts-expect-error private method and property
engine.onWebSocket(peer._internal.nodeReq, peer._internal.nodeReq.socket, peer.websocket);

// @ts-expect-error private method
engine.prepare(req);

const rawSocket = nodeContext.req.socket;
const websocket = nodeContext.ws;

// @ts-expect-error private method
engine.onWebSocket(req, rawSocket, websocket);
// crossws < 0.3.0
// const context = peer.ctx.node;
// // @ts-expect-error private method
// engine.prepare(context.req);
// // @ts-expect-error private method
// engine.onWebSocket(context.req, context.req.socket, context.ws);
}
}
}));
30 changes: 30 additions & 0 deletions examples/typescript-client-example/cjs/client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { io, type Socket } from "socket.io-client";

interface ServerToClientEvents {
hello: (val: string) => void;
}

interface ClientToServerEvents {
ping: (cb: () => void) => void;
}

const socket: Socket<ServerToClientEvents, ClientToServerEvents> = io("ws://localhost:8080/");

socket.on("connect", () => {
console.log(`connect ${socket.id}`);
});

socket.on("hello", (val) => {
console.log(`got ${val}`);
});

socket.on("disconnect", () => {
console.log(`disconnect`);
});

setInterval(() => {
const start = Date.now();
socket.emit("ping", () => {
console.log(`pong (latency: ${Date.now() - start} ms)`);
});
}, 1000);
17 changes: 17 additions & 0 deletions examples/typescript-client-example/cjs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "typescript-client-example-cjs",
"version": "0.0.1",
"description": "An example with TypeScript",
"type": "commonjs",
"private": true,
"scripts": {
"build": "tsc",
"start": "ts-node client.ts"
},
"license": "MIT",
"dependencies": {
"socket.io-client": "^4.8.0",
"ts-node": "^10.9.2",
"typescript": "^5.4.5"
}
}
9 changes: 9 additions & 0 deletions examples/typescript-client-example/cjs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"outDir": "dist",
"target": "es2022",
"module": "nodenext",
"moduleResolution": "nodenext",
"strict": true
}
}
30 changes: 30 additions & 0 deletions examples/typescript-client-example/esm/client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { io, type Socket } from "socket.io-client";

interface ServerToClientEvents {
hello: (val: string) => void;
}

interface ClientToServerEvents {
ping: (cb: () => void) => void;
}

const socket: Socket<ServerToClientEvents, ClientToServerEvents> = io("ws://localhost:8080/");

socket.on("connect", () => {
console.log(`connect ${socket.id}`);
});

socket.on("hello", (val) => {
console.log(`got ${val}`);
});

socket.on("disconnect", () => {
console.log(`disconnect`);
});

setInterval(() => {
const start = Date.now();
socket.emit("ping", () => {
console.log(`pong (latency: ${Date.now() - start} ms)`);
});
}, 1000);
17 changes: 17 additions & 0 deletions examples/typescript-client-example/esm/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "typescript-client-example-esm",
"version": "0.0.1",
"description": "An example with TypeScript",
"type": "module",
"private": true,
"scripts": {
"build": "tsc",
"start": "node --no-warnings=ExperimentalWarning --loader ts-node/esm client.ts"
},
"license": "MIT",
"dependencies": {
"socket.io-client": "^4.8.0",
"ts-node": "^10.9.2",
"typescript": "^5.4.5"
}
}
9 changes: 9 additions & 0 deletions examples/typescript-client-example/esm/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"outDir": "dist",
"target": "es2022",
"module": "esnext",
"moduleResolution": "node",
"strict": true
}
}
Loading