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.4 to 0.1.5

7

lib/ClientManager/Client.js

@@ -19,5 +19,10 @@ "use strict";

sendMessage(msg, evtId) {
this.sendEvent(new Any_1.ClientMessageEvent({ clientId: this.id, msg, evtId }));
this.sendEvent(new Any_1.ClientMessageEvent({
fromId: this.id,
clientId: this.id,
msg,
evtId,
}));
}
}
exports.Client = Client;

@@ -25,6 +25,14 @@ "use strict";

case 'client':
this.manager.broadcast(new Any_1.ClientMessageEvent({ clientId: req.toId, msg: response }));
this.manager.broadcast(new Any_1.ClientMessageEvent({
fromId: client.id,
clientId: req.toId,
msg: response,
}));
break;
case 'room':
this.manager.broadcast(new W_A_1.RoomMessageEvent({ roomId: req.toId, msg: response }));
this.manager.broadcast(new W_A_1.RoomMessageEvent({
fromId: client.id,
roomId: req.toId,
msg: response,
}));
break;

@@ -31,0 +39,0 @@ }

@@ -30,3 +30,7 @@ "use strict";

if (RoomJoinCommandProcessor.BROADCAST_TO_OTHER_IN_ROOM) {
this.manager.broadcast(new W_A_1.RoomMessageEvent({ roomId: msg.roomId, msg: response }));
this.manager.broadcast(new W_A_1.RoomMessageEvent({
fromId: client.id,
roomId: msg.roomId,
msg: response,
}));
}

@@ -58,3 +62,7 @@ });

if (RoomExitCommandProcessor.BROADCAST_TO_OTHER_IN_ROOM) {
this.manager.broadcast(new W_A_1.RoomMessageEvent({ roomId: msg.roomId, msg: response }));
this.manager.broadcast(new W_A_1.RoomMessageEvent({
fromId: client.id,
roomId: msg.roomId,
msg: response,
}));
}

@@ -61,0 +69,0 @@ });

@@ -19,3 +19,11 @@ "use strict";

room.clients.forEach(c => {
this.manager.eventProcess(new Any_1.ClientMessageEvent({ clientId: c.id, msg: evt.data.msg }, evt.id));
// 不发送给自己
if (c.id === evt.data.fromId) {
return;
}
this.manager.eventProcess(new Any_1.ClientMessageEvent({
fromId: evt.data.fromId,
clientId: c.id,
msg: evt.data.msg,
}, evt.id));
});

@@ -22,0 +30,0 @@ });

@@ -7,2 +7,3 @@ import { BaseEvent } from '../common/BaseEvent';

export declare class ClientMessageEvent extends BaseEvent<{
fromId: string;
clientId: string;

@@ -9,0 +10,0 @@ msg: {

@@ -26,2 +26,3 @@ import { BaseEvent } from '../common/BaseEvent';

export declare class RoomMessageEvent extends BaseEvent<{
fromId: string;
roomId: string;

@@ -28,0 +29,0 @@ msg: any;

2

package.json
{
"name": "egg-ez-ws",
"version": "0.1.4",
"version": "0.1.5",
"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