-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Comparing changes
Open a pull request
base repository: socketio/socket.io
base: 225ade062a13030164f89356b0a41f28203c3458
head repository: socketio/socket.io
compare: 8ecfcba5c14cff079c59ccc32e6e5150b17b4a56
Commits on Mar 1, 2021
-
feat: allow to exclude specific rooms when broadcasting (#3789)
Configuration menu - View commit details
-
Copy full SHA for 7de2e87 - Browse repository at this point
Copy the full SHA 7de2e87View commit details -
fix: make io.to(...) immutable
Previously, broadcasting to a given room (by calling `io.to()`) would mutate the io instance, which could lead to surprising behaviors, like: ```js io.to("room1"); io.to("room2").emit(...); // also sent to room1 // or with async/await io.to("room3").emit("details", await fetchDetails()); // random behavior: maybe in room3, maybe to all clients ``` Calling `io.to()` (or any other broadcast modifier) will now return an immutable instance. Related: - #3431 - #3444
Configuration menu - View commit details
-
Copy full SHA for ac9e8ca - Browse repository at this point
Copy the full SHA ac9e8caView commit details -
feat: allow to pass an array to io.to(...)
In some cases it is necessary to pass an array of rooms instead of a single room. New syntax: ``` io.to(["room1", "room2"]).except(["room3"]).emit(...); socket.to(["room1", "room2"]).except(["room3"]).emit(...); ``` Related: #3048
Configuration menu - View commit details
-
Copy full SHA for 085d1de - Browse repository at this point
Copy the full SHA 085d1deView commit details
Commits on Mar 2, 2021
-
feat: add some utility methods
This commit adds the following methods: - fetchSockets: returns the matching socket instances Syntax: ```js // return all Socket instances const sockets = await io.fetchSockets(); // return all Socket instances of the "admin" namespace in the "room1" room const sockets = await io.of("/admin").in("room1").fetchSockets(); ``` - socketsJoin: makes the matching socket instances join the specified rooms Syntax: ```js // make all Socket instances join the "room1" room io.socketsJoin("room1"); // make all Socket instances of the "admin" namespace in the "room1" room join the "room2" room io.of("/admin").in("room1").socketsJoin("room2"); ``` - socketsLeave: makes the matching socket instances leave the specified rooms Syntax: ```js // make all Socket instances leave the "room1" room io.socketsLeave("room1"); // make all Socket instances of the "admin" namespace in the "room1" room leave the "room2" room io.of("/admin").in("room1").socketsLeave("room2"); ``` - disconnectSockets: makes the matching socket instances disconnect Syntax: ```js // make all Socket instances disconnect io.disconnectSockets(); // make all Socket instances of the "admin" namespace in the "room1" room disconnect io.of("/admin").in("room1").disconnectSockets(); ``` Those methods share the same semantics as broadcasting. They will also work with multiple Socket.IO servers when using the Redis adapter. In that case, the fetchSockets() method will return a list of RemoteSocket instances, which expose a subset of the methods and attributes of the Socket class (the "request" attribute cannot be mocked, for example). Related: - #3042 - #3418 - #3570 - socketio/socket.io-redis-adapter#283
Configuration menu - View commit details
-
Copy full SHA for b25495c - Browse repository at this point
Copy the full SHA b25495cView commit details
Commits on Mar 9, 2021
-
feat: add support for typed events (#3822)
Syntax: ```ts interface ClientToServerEvents { "my-event": (a: number, b: string, c: number[]) => void; } interface ServerToClientEvents { hello: (message: string) => void; } const io = new Server<ClientToServerEvents, ServerToClientEvents>(httpServer); io.emit("hello", "world"); io.on("connection", (socket) => { socket.on("my-event", (a, b, c) => { // ... }); socket.emit("hello", "again"); }); ``` The events are not typed by default (inferred as any), so this change is backward compatible. Note: we could also have reused the method here ([1]) to add types to the EventEmitter, instead of creating a StrictEventEmitter class. Related: #3742 [1]: https://github.com/binier/tiny-typed-emitter
Configuration menu - View commit details
-
Copy full SHA for 0107510 - Browse repository at this point
Copy the full SHA 0107510View commit details
Commits on Mar 10, 2021
-
Release notes: https://github.com/socketio/engine.io/releases/tag/5.0.0
Configuration menu - View commit details
-
Copy full SHA for 1b6d6de - Browse repository at this point
Copy the full SHA 1b6d6deView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5eaeffc - Browse repository at this point
Copy the full SHA 5eaeffcView commit details
Commits on Mar 18, 2021
-
fix(typings): update return type from emit (#3843)
``` (channel ? io.to(channel) : io).emit("stuff", message); ``` would no longer compile. Related: #3844
Configuration menu - View commit details
-
Copy full SHA for 1a72ae4 - Browse repository at this point
Copy the full SHA 1a72ae4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 64be1c9 - Browse repository at this point
Copy the full SHA 64be1c9View commit details -
Configuration menu - View commit details
-
Copy full SHA for b4ae8d2 - Browse repository at this point
Copy the full SHA b4ae8d2View commit details
Commits on Mar 24, 2021
-
docs(examples): remove unnecessary type annotations (#3855)
Typed events in Socket.IO 4.0 remove the need for writing type annotations in callbacks of reserved events.
Configuration menu - View commit details
-
Copy full SHA for 259f297 - Browse repository at this point
Copy the full SHA 259f297View commit details
Commits on Mar 31, 2021
-
Configuration menu - View commit details
-
Copy full SHA for a11152f - Browse repository at this point
Copy the full SHA a11152fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 1faa7e3 - Browse repository at this point
Copy the full SHA 1faa7e3View commit details
Commits on Apr 22, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 3665aad - Browse repository at this point
Copy the full SHA 3665aadView commit details
Commits on May 6, 2021
-
fix: properly export the Socket class
Before this change, `require("socket.io").Socket` would return "undefined". Note: having access to the Socket class allows users to modify its prototype. Related: #3726
Configuration menu - View commit details
-
Copy full SHA for d65b6ee - Browse repository at this point
Copy the full SHA d65b6eeView commit details -
Configuration menu - View commit details
-
Copy full SHA for b81ce4c - Browse repository at this point
Copy the full SHA b81ce4cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9fff034 - Browse repository at this point
Copy the full SHA 9fff034View commit details
Commits on May 10, 2021
-
perf: add support for the "wsPreEncoded" writing option
Packets that are sent to multiple clients will now be pre-encoded for the WebSocket transport (which means simply prepending "4" - which is the "message" packet type in Engine.IO). Note: buffers are not pre-encoded, since they are sent without modification over the WebSocket connection See also: socketio/engine.io@7706b12 engine.io diff: socketio/engine.io@5.0.0...5.1.0
Configuration menu - View commit details
-
Copy full SHA for dc381b7 - Browse repository at this point
Copy the full SHA dc381b7View commit details -
feat: add support for inter-server communication
Syntax: ```js // server A io.serverSideEmit("hello", "world"); // server B io.on("hello", (arg) => { console.log(arg); // prints "world" }); ``` With acknowledgements: ```js // server A io.serverSideEmit("hello", "world", (err, responses) => { console.log(responses); // prints ["hi"] }); // server B io.on("hello", (arg, callback) => { callback("hi"); }); ``` This feature replaces the customHook/customRequest API from the Redis adapter: socketio/socket.io-redis-adapter#370
Configuration menu - View commit details
-
Copy full SHA for 93cce05 - Browse repository at this point
Copy the full SHA 93cce05View commit details -
feat: notify upon namespace creation
A "new_namespace" event will be emitted when a new namespace is created: ```js io.on("new_namespace", (namespace) => { // ... }); ``` This could be used for example for registering the same middleware for each namespace. See #3851
Configuration menu - View commit details
-
Copy full SHA for 499c892 - Browse repository at this point
Copy the full SHA 499c892View commit details -
Configuration menu - View commit details
-
Copy full SHA for 95d9e4a - Browse repository at this point
Copy the full SHA 95d9e4aView commit details
Commits on May 11, 2021
-
Configuration menu - View commit details
-
Copy full SHA for fb6b0ef - Browse repository at this point
Copy the full SHA fb6b0efView commit details -
3
Configuration menu - View commit details
-
Copy full SHA for b84ed1e - Browse repository at this point
Copy the full SHA b84ed1eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 891b187 - Browse repository at this point
Copy the full SHA 891b187View commit details -
Configuration menu - View commit details
-
Copy full SHA for 995f38f - Browse repository at this point
Copy the full SHA 995f38fView commit details
Commits on May 17, 2021
-
fix: ensure compatibility with previous versions of the adapter
Using `socket.io@4.1.0` with `socket.io-adapter@2.2.0` would lead to the following error: > Uncaught Error: unknown packet type NaN Because the packet would be encoded twice, resulting in "undefined". See also: - socketio/socket.io-adapter@5579d40 - dc381b7 Related: - #3922 - #3927
Configuration menu - View commit details
-
Copy full SHA for a2cf248 - Browse repository at this point
Copy the full SHA a2cf248View commit details -
fix(typings): ensure compatibility with TypeScript 3.x
Labeled tuple elements were added in TypeScript 4.0. Reference: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-0.html#labeled-tuple-elements Related: #3916
Configuration menu - View commit details
-
Copy full SHA for 0cb6ac9 - Browse repository at this point
Copy the full SHA 0cb6ac9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1633150 - Browse repository at this point
Copy the full SHA 1633150View commit details
Commits on Jun 15, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 6f2a50b - Browse repository at this point
Copy the full SHA 6f2a50bView commit details
Commits on Jun 24, 2021
-
ci: update setup-node step (#3986)
Daniele TDC authoredJun 24, 2021 Configuration menu - View commit details
-
Copy full SHA for 24d8d1f - Browse repository at this point
Copy the full SHA 24d8d1fView commit details
Commits on Jun 28, 2021
-
Configuration menu - View commit details
-
Copy full SHA for b833f91 - Browse repository at this point
Copy the full SHA b833f91View commit details
Commits on Jul 3, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 7c44893 - Browse repository at this point
Copy the full SHA 7c44893View commit details -
fix: remove x-sourcemap header
This header is useless, as the client bundle already contains a sourceMappingURL field. Besides, Firefox prints the following warning: > <url> is being assigned a //# sourceMappingURL, but already has one Related: #3958
Configuration menu - View commit details
-
Copy full SHA for a4dffc6 - Browse repository at this point
Copy the full SHA a4dffc6View commit details
Commits on Jul 10, 2021
-
Previously, calling `io.except("theroom").emit(...)` did not exclude the sockets in the given room. This method was forgotten in [1]. [1]: ac9e8ca
Configuration menu - View commit details
-
Copy full SHA for 94e27cd - Browse repository at this point
Copy the full SHA 94e27cdView commit details -
Configuration menu - View commit details
-
Copy full SHA for dbd2a07 - Browse repository at this point
Copy the full SHA dbd2a07View commit details
Commits on Jul 15, 2021
-
docs(examples): add missing module (#4018)
Fixes the following error: > test/todo-management/todo.tests.ts:275:3 - error TS2582: Cannot find name 'describe'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha`. Co-authored-by: brownman <brownman@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 310f855 - Browse repository at this point
Copy the full SHA 310f855View commit details
Commits on Aug 30, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 24fee27 - Browse repository at this point
Copy the full SHA 24fee27View commit details -
fix(typings): allow async listener in typed events
So that: ```ts socket.on("my-event", async () => { // ... }); ``` is valid under the @typescript-eslint/no-misused-promises rule. Related: socketio/socket.io-client#1486
Configuration menu - View commit details
-
Copy full SHA for ccfd8ca - Browse repository at this point
Copy the full SHA ccfd8caView commit details -
docs: update the link of the Repl.it badge
The link will now point towards a sample project, instead of the root repository. Related: #3934
Configuration menu - View commit details
-
Copy full SHA for d8cc8ae - Browse repository at this point
Copy the full SHA d8cc8aeView commit details -
Configuration menu - View commit details
-
Copy full SHA for f03eeca - Browse repository at this point
Copy the full SHA f03eecaView commit details -
Configuration menu - View commit details
-
Copy full SHA for c100b7b - Browse repository at this point
Copy the full SHA c100b7bView commit details
Commits on Sep 9, 2021
-
Configuration menu - View commit details
-
Copy full SHA for dc81fcf - Browse repository at this point
Copy the full SHA dc81fcfView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7a74b66 - Browse repository at this point
Copy the full SHA 7a74b66View commit details
Commits on Sep 20, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 033c5d3 - Browse repository at this point
Copy the full SHA 033c5d3View commit details
Commits on Oct 8, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 4974e90 - Browse repository at this point
Copy the full SHA 4974e90View commit details
Commits on Oct 11, 2021
-
chore: bump engine.io to version 6.0.0
Release notes: https://github.com/socketio/engine.io/releases/tag/6.0.0 Diff: socketio/engine.io@5.2.0...6.0.0
Configuration menu - View commit details
-
Copy full SHA for eb5fdbd - Browse repository at this point
Copy the full SHA eb5fdbdView commit details
Commits on Oct 13, 2021
-
2
Configuration menu - View commit details
-
Copy full SHA for 60edecb - Browse repository at this point
Copy the full SHA 60edecbView commit details
Commits on Oct 14, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 95810aa - Browse repository at this point
Copy the full SHA 95810aaView commit details
Commits on Oct 16, 2021
-
fix: fix server attachment (#4127)
The check excluded an HTTPS server from being properly attached. Related: #4124
Configuration menu - View commit details
-
Copy full SHA for 0ef2a4d - Browse repository at this point
Copy the full SHA 0ef2a4dView commit details -
Configuration menu - View commit details
-
Copy full SHA for ccc5ec3 - Browse repository at this point
Copy the full SHA ccc5ec3View commit details
There are no files selected for viewing