@manch1kz/yanac 1.0.6 → 1.0.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/README.md +1 -1
- package/build/client/commands/clientCommandHandler.js +5 -1
- package/build/server/handlers/processMessage.js +1 -1
- package/build/server/handlers/serverCommandHandler.js +3 -3
- package/client/commands/clientCommandHandler.ts +5 -1
- package/package.json +1 -1
- package/server/handlers/processMessage.ts +1 -1
- package/server/handlers/serverCommandHandler.ts +3 -3
- package/benchmark.bat +0 -4
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ Options for server:
|
|
|
22
22
|
|
|
23
23
|
Options for client:
|
|
24
24
|
* ```--port <limit>``` - port (default: 3000)
|
|
25
|
-
* ```--host <limit>``` - host (default:
|
|
25
|
+
* ```--host <limit>``` - host (default: localhost)
|
|
26
26
|
* ```--name <limit>``` - port (default: random_string)
|
|
27
27
|
|
|
28
28
|
## Demonstration
|
|
@@ -14,7 +14,11 @@ function processEnteredCommand(command) {
|
|
|
14
14
|
break;
|
|
15
15
|
case "online":
|
|
16
16
|
case "ping":
|
|
17
|
-
this.server.write((0, edUtils_1.encrypt)(JSON.stringify({
|
|
17
|
+
this.server.write((0, edUtils_1.encrypt)(JSON.stringify({
|
|
18
|
+
type: "command",
|
|
19
|
+
body: formated,
|
|
20
|
+
metadata: Date.now(),
|
|
21
|
+
}), this.manager.session_key));
|
|
18
22
|
break;
|
|
19
23
|
default:
|
|
20
24
|
console.log("No command found");
|
|
@@ -23,7 +23,7 @@ function processMessage(socket, data) {
|
|
|
23
23
|
broadcast.call(this, message.body, [socket]);
|
|
24
24
|
break;
|
|
25
25
|
case "command":
|
|
26
|
-
serverCommandHandler_1.processClientCommand.call(this, message
|
|
26
|
+
serverCommandHandler_1.processClientCommand.call(this, message, socket, socket_generator);
|
|
27
27
|
break;
|
|
28
28
|
case "finished":
|
|
29
29
|
socket_item.name = message.body;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.processClientCommand = processClientCommand;
|
|
4
4
|
const edUtils_1 = require("../../utils/edUtils");
|
|
5
|
-
function processClientCommand(
|
|
6
|
-
switch (
|
|
5
|
+
function processClientCommand(message, socket, socket_generator) {
|
|
6
|
+
switch (message.body) {
|
|
7
7
|
case "online":
|
|
8
8
|
socket.write((0, edUtils_1.encrypt)(JSON.stringify({
|
|
9
9
|
type: "online",
|
|
@@ -11,7 +11,7 @@ function processClientCommand(command, socket, socket_generator) {
|
|
|
11
11
|
}), socket_generator.session_key));
|
|
12
12
|
break;
|
|
13
13
|
case "ping":
|
|
14
|
-
socket.write((0, edUtils_1.encrypt)(JSON.stringify({ type: "ping", body:
|
|
14
|
+
socket.write((0, edUtils_1.encrypt)(JSON.stringify({ type: "ping", body: message.metadata }), socket_generator.session_key));
|
|
15
15
|
break;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -18,7 +18,11 @@ function processEnteredCommand(this: Client, command: string) {
|
|
|
18
18
|
case "ping":
|
|
19
19
|
this.server.write(
|
|
20
20
|
encrypt(
|
|
21
|
-
JSON.stringify({
|
|
21
|
+
JSON.stringify({
|
|
22
|
+
type: "command",
|
|
23
|
+
body: formated,
|
|
24
|
+
metadata: Date.now(),
|
|
25
|
+
}),
|
|
22
26
|
this.manager.session_key,
|
|
23
27
|
),
|
|
24
28
|
);
|
package/package.json
CHANGED
|
@@ -3,11 +3,11 @@ import { encrypt } from "../../utils/edUtils";
|
|
|
3
3
|
|
|
4
4
|
function processClientCommand(
|
|
5
5
|
this: Server,
|
|
6
|
-
|
|
6
|
+
message: any,
|
|
7
7
|
socket: any,
|
|
8
8
|
socket_generator: any,
|
|
9
9
|
) {
|
|
10
|
-
switch (
|
|
10
|
+
switch (message.body) {
|
|
11
11
|
case "online":
|
|
12
12
|
socket.write(
|
|
13
13
|
encrypt(
|
|
@@ -22,7 +22,7 @@ function processClientCommand(
|
|
|
22
22
|
case "ping":
|
|
23
23
|
socket.write(
|
|
24
24
|
encrypt(
|
|
25
|
-
JSON.stringify({ type: "ping", body:
|
|
25
|
+
JSON.stringify({ type: "ping", body: message.metadata }),
|
|
26
26
|
socket_generator.session_key,
|
|
27
27
|
),
|
|
28
28
|
);
|
package/benchmark.bat
DELETED