@ekhein/sekiro-node-client 2.1.4 → 2.1.7

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/main.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import { WebSocket } from 'partysocket';
2
2
  export declare class SekiroClient extends WebSocket {
3
3
  readonly clientId: string;
4
+ readonly namespace: string;
4
5
  readonly host: string;
5
6
  readonly port: string;
6
- readonly namespace: string;
7
7
  private readonly logger;
8
8
  private readonly handlers;
9
- constructor(clientId?: string, host?: string, port?: string, namespace?: string);
9
+ constructor(clientId?: string, namespace?: string, host?: string, port?: string);
10
10
  private onOpen;
11
11
  private onClose;
12
12
  private onError;
package/dist/main.js CHANGED
@@ -8,29 +8,29 @@ const result_util_1 = require("./utils/result.util");
8
8
  const logger_util_1 = require("./utils/logger.util");
9
9
  class SekiroClient extends partysocket_1.WebSocket {
10
10
  clientId;
11
+ namespace;
11
12
  host;
12
13
  port;
13
- namespace;
14
14
  logger = new logger_util_1.Logger(this);
15
15
  handlers = new Map();
16
- constructor(clientId = (0, crypto_1.randomUUID)().replace(/-/g, ""), host = process.env.SEKIRO_HOST, port = process.env.SEKIRO_PORT, namespace = process.env.namespace) {
16
+ constructor(clientId = (0, crypto_1.randomUUID)().replace(/-/g, ""), namespace = process.env.namespace, host = process.env.SEKIRO_HOST, port = process.env.SEKIRO_PORT) {
17
17
  super("ws://", [], {
18
18
  debug: false,
19
19
  maxEnqueuedMessages: -1,
20
20
  WebSocket: class extends ws_1.WebSocket {
21
21
  constructor() {
22
- const group = String(namespace).toLowerCase();
23
- const wsURL = new URL("/business-demo/register", "ws://" + host + ":" + port);
24
- wsURL.searchParams.append("group", group);
22
+ const serve = new Array("ws://", host, ":", port).join("");
23
+ const wsURL = new URL("/business-demo/register", serve);
24
+ wsURL.searchParams.append("group", namespace);
25
25
  wsURL.searchParams.append("clientId", clientId);
26
26
  super(wsURL);
27
27
  }
28
28
  }
29
29
  });
30
30
  this.clientId = clientId;
31
+ this.namespace = namespace;
31
32
  this.host = host;
32
33
  this.port = port;
33
- this.namespace = namespace;
34
34
  super.addEventListener("open", this.onOpen.bind(this));
35
35
  super.addEventListener("message", this.onData.bind(this));
36
36
  super.addEventListener("close", this.onClose.bind(this));
@@ -11,7 +11,7 @@ class Logger {
11
11
  const time = new Date().toLocaleString();
12
12
  const namespace = String(this.context.namespace);
13
13
  const clientId = String(this.context.clientId);
14
- const base = (0, util_1.format)("[%s] [%s] [%s] [%s] [%s]", level, time, namespace, clientId);
14
+ const base = (0, util_1.format)("[%s] [%s] [%s] [%s]", level, time, namespace, clientId);
15
15
  switch (level) {
16
16
  case "INFO":
17
17
  console.info(base, ...message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ekhein/sekiro-node-client",
3
- "version": "2.1.4",
3
+ "version": "2.1.7",
4
4
  "license": "MIT",
5
5
  "author": "ekhein",
6
6
  "main": "./dist/main.js",