@cimo/websocket 1.1.28 → 1.1.29

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.
Files changed (2) hide show
  1. package/README.md +7 -4
  2. package/package.json +4 -2
package/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Websocket
2
2
 
3
3
  Websocket (server/client). Light, fast and secure.
4
+ Write with native Typescript code and no dependencies is used.
4
5
 
5
6
  ## Pack
6
7
 
@@ -51,7 +52,8 @@ import { CwsServer } from "@cimo/websocket";
51
52
  export const websocket = (cwsServer: CwsServer, cp: Cp) => {
52
53
  cwsServer.receiveData("action_test", (clientId, data) => {
53
54
  if (typeof data === "string") {
54
- cwsServer.sendData(clientId, 1, JSON.stringify({ test: "end" }), "action_test");
55
+ const requestWsData = { test: "end" } as Record<string, string>;
56
+ cwsServer.sendData(clientId, 1, JSON.stringify(requestWsData), "action_test");
55
57
  }
56
58
  });
57
59
  };
@@ -75,15 +77,16 @@ const cwsClient = new CwsClient("wss://localhost");
75
77
  cwsClient.checkConnection(() => {
76
78
  cwsClient.receiveData("action_test", (data) => {
77
79
  if (typeof data === "string") {
78
- const message = JSON.parse(data) as Record<string, string>;
80
+ const responseWsData = JSON.parse(data) as Record<string, string>;
79
81
 
80
- console.log(message);
82
+ console.log(responseWsData);
81
83
  }
82
84
  });
83
85
  });
84
86
 
85
87
  elementButton.addEventListener("click", (event) => {
86
- cwsClient.sendData(1, JSON.stringify({ test: "start" }), "action_test");
88
+ const requestWsData = { test: "start" } as Record<string, string>;
89
+ cwsClient.sendData(1, JSON.stringify(requestWsData), "action_test");
87
90
  });
88
91
 
89
92
  ...
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cimo/websocket",
3
- "version": "1.1.28",
3
+ "version": "1.1.29",
4
4
  "description": "Websocket (server/client). Light, fast and secure.",
5
5
  "author": "cimo",
6
6
  "license": "MIT",
@@ -39,6 +39,8 @@
39
39
  "nodejs",
40
40
  "express",
41
41
  "typescript",
42
- "cimo"
42
+ "cimo",
43
+ "native",
44
+ "no dependencies"
43
45
  ]
44
46
  }