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

egg-ez-ws

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

egg-ez-ws - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

5

lib/ClientManager/Command/DebugCommand.d.ts

@@ -9,3 +9,6 @@ import { BaseCommandProcessor } from './BaseCommandProcessor';

type: 'DEBUG';
data: any;
data: {
req: DebugCommandRequest;
res?: any;
};
}

@@ -12,0 +15,0 @@ export declare class DebugCommandProcessor extends BaseCommandProcessor {

8

lib/ClientManager/Command/DebugCommand.js

@@ -18,3 +18,5 @@ "use strict";

type: 'DEBUG',
data: {},
data: {
req: msg,
},
};

@@ -24,3 +26,3 @@ switch (msg.cmd) {

const roomIds = yield this.manager.broadcast(new W_A_1.RoomListRequestEvent({}), A_W_1.RoomListInfoResponseEvent);
response.data = roomIds && roomIds.data;
response.data.res = roomIds && roomIds.data;
break;

@@ -33,3 +35,3 @@ case 'RoomInfo':

}), A_W_1.RoomInfoResponseEvent);
response.data = info && info.data;
response.data.res = info && info.data;
break;

@@ -36,0 +38,0 @@ }

@@ -22,2 +22,3 @@ "use strict";

data: client.ext.data,
gmtCreated: client.ext.gmtCreated,
roomIds: [...client.rooms.values()].map(room => room.id),

@@ -24,0 +25,0 @@ }, evt.id);

@@ -19,4 +19,6 @@ "use strict";

return new A_W_1.RoomInfoResponseEvent({
id: evt.id,
id: room.id,
info: room.ext.info,
data: room.ext.data,
gmtCreated: room.ext.gmtCreated,
clients: [...room.clients.values()].map(c => {

@@ -27,2 +29,3 @@ return {

data: c.ext.data,
gmtCreated: c.ext.gmtCreated,
};

@@ -29,0 +32,0 @@ }),

@@ -17,4 +17,4 @@ import { Agent } from 'egg';

declare class ClientInfo {
readonly type: ClientType;
readonly id: string;
readonly type: ClientType;
ext: {

@@ -27,3 +27,3 @@ info: {};

readonly rooms: Map<string, RoomInfo>;
constructor(id: string, type?: ClientType);
constructor(info: IClientInfo, type?: ClientType);
}

@@ -30,0 +30,0 @@ export declare class ClusterManager extends BaseManager<Agent> {

@@ -26,6 +26,5 @@ "use strict";

class ClientInfo {
constructor(id,
constructor(info,
// 是否为本地连接客户端
type = 'local') {
this.id = id;
this.type = type;

@@ -42,2 +41,5 @@ // TODO 同步

this.rooms = new Map();
this.id = info.id || uuid.v4();
this.ext.info = info.info || {};
this.ext.data = info.data || {};
}

@@ -59,3 +61,3 @@ }

this.logger.debug('[cluster] client connect', info);
const client = new ClientInfo(info.id);
const client = new ClientInfo(info);
this.clients.set(info.id, client);

@@ -62,0 +64,0 @@ return client;

@@ -6,2 +6,3 @@ export interface IClientInfo<T = any> {

roomIds?: string[];
gmtCreated?: number;
}

@@ -13,3 +14,4 @@ export interface IRoomInfo<T = any> {

clients?: IClientInfo[];
gmtCreated?: number;
}
export declare type ClassType = new (...args: any) => any;
{
"name": "egg-ez-ws",
"version": "0.1.2",
"version": "0.1.3",
"description": "easy websocket for egg.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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