-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Permalink
Choose a base ref
{{ refName }}
default
Choose a head ref
{{ refName }}
default
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: 3.1.2
Could not load branches
Nothing to show
Loading
Could not load tags
Nothing to show
{{ refName }}
default
Loading
...
head repository: socketio/socket.io
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4.0.0
Could not load branches
Nothing to show
Loading
Could not load tags
Nothing to show
{{ refName }}
default
Loading
- 7 commits
- 19 files changed
- 3 contributors
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
There are no files selected for viewing