cgserver 11.1.0 → 11.2.0

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.
@@ -136,5 +136,11 @@ class CgMq {
136
136
  }
137
137
  return;
138
138
  }
139
+ async listen(data) {
140
+ return await this._ws.listen(data);
141
+ }
142
+ async unlisten(data) {
143
+ return await this._ws.unlisten(data);
144
+ }
139
145
  }
140
146
  exports.CgMq = CgMq;
@@ -42,8 +42,8 @@ class Rpc {
42
42
  let ret = await this._cgmq.init(cfg, this.onMsg.bind(this));
43
43
  return ret;
44
44
  }
45
- getRemote(group, id = "", listen = "") {
46
- return new Remote(group, id, this._cgmq, listen);
45
+ getRemote(group, id = "", listener = "") {
46
+ return new Remote(group, id, this._cgmq, listener);
47
47
  }
48
48
  async onMsg(msg) {
49
49
  if (!msg || !msg.data || !msg.data.cmd) {
@@ -58,5 +58,13 @@ class Rpc {
58
58
  let data = await Core_1.core.safeCall(func, this, ...msg.data?.args, msg);
59
59
  return data;
60
60
  }
61
+ async listen(listeners) {
62
+ let ret = await this._cgmq.listen(listeners);
63
+ return ret;
64
+ }
65
+ async unlisten(listeners) {
66
+ let ret = await this._cgmq.unlisten(listeners);
67
+ return ret;
68
+ }
61
69
  }
62
70
  exports.Rpc = Rpc;
@@ -43,5 +43,7 @@ export declare class CgMq {
43
43
  init(cfg: RpcConfig, onmsg?: (msg: RpcMsg) => any): Promise<unknown>;
44
44
  callRemote(group: string, to_id: string, listen: string, func_name: string, ...args: any[]): Promise<RpcMsg>;
45
45
  onMsg(msg: RpcMsg): Promise<any>;
46
+ listen(data: string[]): Promise<RpcMsg>;
47
+ unlisten(data: string[]): Promise<RpcMsg>;
46
48
  }
47
49
  export {};
@@ -18,7 +18,9 @@ export declare class Rpc {
18
18
  protected _cgmq: CgMq;
19
19
  get cgmq(): CgMq;
20
20
  init(cfg: RpcConfig): Promise<unknown>;
21
- getRemote(group: string, id?: string, listen?: string): Remote;
21
+ getRemote(group: string, id?: string, listener?: string): Remote;
22
22
  onMsg(msg: RpcMsg): Promise<any>;
23
+ listen(listeners: string[]): Promise<RpcMsg>;
24
+ unlisten(listeners: string[]): Promise<RpcMsg>;
23
25
  }
24
26
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cgserver",
3
- "version": "11.1.0",
3
+ "version": "11.2.0",
4
4
  "author": "trojan",
5
5
  "type": "commonjs",
6
6
  "description": "free for all.Websocket or Http",