Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

socket.io-adapter

Package Overview
Dependencies
Maintainers
2
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

socket.io-adapter - npm Package Compare versions

Comparing version 2.0.3 to 2.1.0

9

CHANGELOG.md

@@ -0,1 +1,10 @@

# [2.1.0](https://github.com/socketio/socket.io-adapter/compare/2.0.3...2.1.0) (2021-01-15)
### Features
* add room events ([155fa63](https://github.com/socketio/socket.io-adapter/commit/155fa6333a504036e99a33667dc0397f6aede25e))
* make rooms and sids public ([313c5a9](https://github.com/socketio/socket.io-adapter/commit/313c5a9fb60d913cd3a866001d67516399d8ee2f))
## [2.0.3](https://github.com/socketio/socket.io-adapter/compare/1.1.2...2.0.3) (2020-11-05)

@@ -2,0 +11,0 @@

5

dist/index.d.ts

@@ -19,4 +19,4 @@ /// <reference types="node" />

readonly nsp: any;
protected rooms: Map<Room, Set<SocketId>>;
protected sids: Map<SocketId, Set<Room>>;
rooms: Map<Room, Set<SocketId>>;
sids: Map<SocketId, Set<Room>>;
private readonly encoder;

@@ -52,2 +52,3 @@ /**

del(id: SocketId, room: Room): Promise<void> | void;
private _del;
/**

@@ -54,0 +55,0 @@ * Removes a socket from all rooms it's joined.

30

dist/index.js

@@ -34,11 +34,15 @@ "use strict";

addAll(id, rooms) {
if (!this.sids.has(id)) {
this.sids.set(id, new Set());
}
for (const room of rooms) {
if (!this.sids.has(id)) {
this.sids.set(id, new Set());
}
this.sids.get(id).add(room);
if (!this.rooms.has(room)) {
this.rooms.set(room, new Set());
this.emit("create-room", room);
}
this.rooms.get(room).add(id);
if (!this.rooms.get(room).has(id)) {
this.rooms.get(room).add(id);
this.emit("join-room", room, id);
}
}

@@ -56,6 +60,14 @@ }

}
this._del(room, id);
}
_del(room, id) {
if (this.rooms.has(room)) {
this.rooms.get(room).delete(id);
if (this.rooms.get(room).size === 0)
const deleted = this.rooms.get(room).delete(id);
if (deleted) {
this.emit("leave-room", room, id);
}
if (this.rooms.get(room).size === 0) {
this.rooms.delete(room);
this.emit("delete-room", room);
}
}

@@ -73,7 +85,3 @@ }

for (const room of this.sids.get(id)) {
if (this.rooms.has(room)) {
this.rooms.get(room).delete(id);
if (this.rooms.get(room).size === 0)
this.rooms.delete(room);
}
this._del(room, id);
}

@@ -80,0 +88,0 @@ this.sids.delete(id);

{
"name": "socket.io-adapter",
"version": "2.0.3",
"version": "2.1.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "repository": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc