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
  • 15 commits
  • 57 files changed
  • 3 contributors

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
  3. refactor(sio): make Namespace._fns private (#5196)

    Related: #5179
    ammut authored Oct 23, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    aead835 View commit details

Commits on Oct 25, 2024

  1. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    darrachequesne Damien Arrachequesne
    Copy the full SHA
    71387e5 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
    8d5528a 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
    91e1c8b View commit details

Commits on Nov 21, 2024

  1. refactor(eio): bump cookie to version 1.0.2

    Release notes: https://github.com/jshttp/cookie/releases/tag/v1.0.0
    
    The types are now included in the npm package. The `CookieSerializeOptions` type, which is used in our `ServerOptions` type, has been renamed to `SerializeOptions`, but there are no breaking change.
    
    Related: #5231
    darrachequesne committed Nov 21, 2024

    Verified

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

Commits on Jan 7, 2025

  1. fix(engine.io-client): correctly consume the ws package (#5220)

    This should fix the following issue:
    
    ```
    SyntaxError: Named export 'WebSocket' not found. The requested module 'ws' is a CommonJS module, which may not support all module.exports as named exports.
    CommonJS modules can always be imported via the default export, for example using:
    
    import pkg from 'ws';
    const { WebSocket } = pkg;
    ```
    benmccann authored Jan 7, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    7fcddcb View commit details

Commits on Jan 23, 2025

  1. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    darrachequesne Damien Arrachequesne
    Copy the full SHA
    bfa6eab 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
    62e4da1 View commit details
Showing with 690 additions and 116 deletions.
  1. +2 −0 .github/workflows/build-examples.yml
  2. +5 −0 .github/workflows/ci.yml
  3. +11 −10 examples/nuxt-example/server/plugins/socket.io.ts
  4. +30 −0 examples/typescript-client-example/cjs/client.ts
  5. +17 −0 examples/typescript-client-example/cjs/package.json
  6. +9 −0 examples/typescript-client-example/cjs/tsconfig.json
  7. +30 −0 examples/typescript-client-example/esm/client.ts
  8. +17 −0 examples/typescript-client-example/esm/package.json
  9. +9 −0 examples/typescript-client-example/esm/tsconfig.json
  10. +373 −30 package-lock.json
  11. +2 −1 package.json
  12. +31 −0 packages/engine.io-client/CHANGELOG.md
  13. +3 −3 packages/engine.io-client/dist/engine.io.esm.min.js
  14. +1 −1 packages/engine.io-client/dist/engine.io.esm.min.js.map
  15. +3 −2 packages/engine.io-client/dist/engine.io.js
  16. +1 −1 packages/engine.io-client/dist/engine.io.js.map
  17. +3 −3 packages/engine.io-client/dist/engine.io.min.js
  18. +1 −1 packages/engine.io-client/dist/engine.io.min.js.map
  19. +3 −3 packages/engine.io-client/lib/transports/websocket.node.ts
  20. +1 −0 packages/engine.io-client/lib/transports/websocket.ts
  21. +2 −1 packages/engine.io-client/package.json
  22. +13 −0 packages/engine.io-client/test/connection.js
  23. +1 −3 packages/engine.io-client/test/index.js
  24. +8 −0 packages/engine.io-client/test/support/env.js
  25. +12 −3 packages/engine.io-client/test/transport.js
  26. +5 −7 packages/engine.io-client/test/webtransport.mjs
  27. +1 −1 packages/engine.io-parser/lib/decodePacket.ts
  28. +14 −0 packages/engine.io/CHANGELOG.md
  29. +2 −2 packages/engine.io/lib/server.ts
  30. +2 −3 packages/engine.io/package.json
  31. +5 −0 packages/engine.io/test/common.js
  32. +5 −7 packages/engine.io/test/webtransport.mjs
  33. +17 −1 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. +2 −1 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. +9 −0 packages/socket.io-client/lib/index.ts
  43. +1 −1 packages/socket.io-client/package.json
  44. +1 −0 packages/socket.io-client/support/rollup.config.umd.js
  45. +13 −0 packages/socket.io/CHANGELOG.md
  46. +2 −2 packages/socket.io/client-dist/socket.io.esm.min.js
  47. +1 −1 packages/socket.io/client-dist/socket.io.esm.min.js.map
  48. +2 −1 packages/socket.io/client-dist/socket.io.js
  49. +1 −1 packages/socket.io/client-dist/socket.io.js.map
  50. +2 −2 packages/socket.io/client-dist/socket.io.min.js
  51. +1 −1 packages/socket.io/client-dist/socket.io.min.js.map
  52. +2 −2 packages/socket.io/client-dist/socket.io.msgpack.min.js
  53. +1 −1 packages/socket.io/client-dist/socket.io.msgpack.min.js.map
  54. +1 −1 packages/socket.io/lib/namespace.ts
  55. +1 −1 packages/socket.io/lib/parent-namespace.ts
  56. +1 −1 packages/socket.io/package.json
  57. +0 −7 packages/socket.io/test/index.ts
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
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@ jobs:
node-version:
- 18
- 20
- 22

services:
redis:
@@ -59,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