expresso-macchiato 0.3.8-dev.3 → 0.3.8-dev.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -488,7 +488,7 @@ declare class SocketWrapper<Metadata extends Record<string, any> = any> {
488
488
  broadcastExceptClient: (clientId: string, eventName: string, data: any) => void;
489
489
  sendToClient: (clientId: string, eventName: string, data: any) => void;
490
490
  sendToRoom: (room: string, eventName: string, data: any) => void;
491
- getConnectedSockets: () => ConnectedSocketClient[];
491
+ getConnectedSockets: () => Map<string, ConnectedSocketClient>;
492
492
  getClientById: (clientId: string) => ConnectedSocketClient | undefined;
493
493
  getClientByMetadataKey: (key: keyof Metadata, value: any) => ConnectedSocketClient | undefined;
494
494
  }
package/dist/index.d.ts CHANGED
@@ -488,7 +488,7 @@ declare class SocketWrapper<Metadata extends Record<string, any> = any> {
488
488
  broadcastExceptClient: (clientId: string, eventName: string, data: any) => void;
489
489
  sendToClient: (clientId: string, eventName: string, data: any) => void;
490
490
  sendToRoom: (room: string, eventName: string, data: any) => void;
491
- getConnectedSockets: () => ConnectedSocketClient[];
491
+ getConnectedSockets: () => Map<string, ConnectedSocketClient>;
492
492
  getClientById: (clientId: string) => ConnectedSocketClient | undefined;
493
493
  getClientByMetadataKey: (key: keyof Metadata, value: any) => ConnectedSocketClient | undefined;
494
494
  }
package/dist/index.js CHANGED
@@ -719,7 +719,7 @@ var SocketWrapper = class {
719
719
  if (!this.data.listeners) throw new Error("No listeners provided");
720
720
  this.namespace = io.of(`/${this.socketNamespace}`);
721
721
  if (this.data.connectionMiddleware) {
722
- io.use(async (client, next) => {
722
+ this.namespace.use(async (client, next) => {
723
723
  const commId = client.handshake.query.commId;
724
724
  const metadata = client.handshake.query.metadata;
725
725
  const beforeResult = await this.data.connectionMiddleware(this, client, commId, metadata);
@@ -731,7 +731,7 @@ var SocketWrapper = class {
731
731
  next();
732
732
  });
733
733
  }
734
- io.on("connection", (client) => {
734
+ this.namespace.on("connection", (client) => {
735
735
  try {
736
736
  if (!this.namespace) throw new Error("Socket.IO not initialized");
737
737
  const metadata = client.handshake.query.metadata;
@@ -795,7 +795,7 @@ var SocketWrapper = class {
795
795
  }
796
796
  };
797
797
  // --- GETTERS
798
- this.getConnectedSockets = () => Array.from(this.connectedClients.values());
798
+ this.getConnectedSockets = () => this.connectedClients;
799
799
  this.getClientById = (clientId) => this.connectedClients.get(clientId);
800
800
  this.getClientByMetadataKey = (key, value) => {
801
801
  for (const client of this.connectedClients.values()) {
package/dist/index.mjs CHANGED
@@ -719,7 +719,7 @@ var SocketWrapper = class {
719
719
  if (!this.data.listeners) throw new Error("No listeners provided");
720
720
  this.namespace = io.of(`/${this.socketNamespace}`);
721
721
  if (this.data.connectionMiddleware) {
722
- io.use(async (client, next) => {
722
+ this.namespace.use(async (client, next) => {
723
723
  const commId = client.handshake.query.commId;
724
724
  const metadata = client.handshake.query.metadata;
725
725
  const beforeResult = await this.data.connectionMiddleware(this, client, commId, metadata);
@@ -731,7 +731,7 @@ var SocketWrapper = class {
731
731
  next();
732
732
  });
733
733
  }
734
- io.on("connection", (client) => {
734
+ this.namespace.on("connection", (client) => {
735
735
  try {
736
736
  if (!this.namespace) throw new Error("Socket.IO not initialized");
737
737
  const metadata = client.handshake.query.metadata;
@@ -795,7 +795,7 @@ var SocketWrapper = class {
795
795
  }
796
796
  };
797
797
  // --- GETTERS
798
- this.getConnectedSockets = () => Array.from(this.connectedClients.values());
798
+ this.getConnectedSockets = () => this.connectedClients;
799
799
  this.getClientById = (clientId) => this.connectedClients.get(clientId);
800
800
  this.getClientByMetadataKey = (key, value) => {
801
801
  for (const client of this.connectedClients.values()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expresso-macchiato",
3
- "version": "0.3.8-dev.3",
3
+ "version": "0.3.8-dev.5",
4
4
  "author": "Alessio Velluso",
5
5
  "license": "MIT",
6
6
  "description": "Description",