1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
# SocketIO
## Client
Socketio is setup in the file `globals`.
This means, import `globals`, and then you can use `Socket` from there.
### Connect
1. Client first needs to get an Authentication token,
this can be obtained by doing this:
```javascript
import {setCookie} from "../../../cookies";
let CryptoJS = require("crypto-js");
let passwordHash = CryptoJS.SHA256(<PASSWORD>;).toString();
Socket.emit("authenticate", <USERNAME>, passwordHash, (token) => {
// Token will be a string if username/password combo is right,
// if not, it is false.
setCookie("session_token", token, 500);
};)
```
2. Then the user can authenticate like this:
```javascript
import {getCookie} from "../../../cookies";
let cookieToken = getCookie("session_token");
Socket.emit("authenticateToken", cookieToken, (res) => {
// Res is true if we got authenticated,
// If not, it is false.
});
```
3. We are now authenticated, and all actions and events are available to the client.
### "Actions"
```javascript
Socket.emit(Action, *Arguments, (Return) => {
};)
```
##### NeoRuntime/status
| Name | Type | Description |
| ------ | ------ | ----------- |
| status | object | |
??? info "Return/status"
| Name | Type | Description |
| -------------- | ------- | ----------------------------- |
| currentScript | string | "None"/Name of current script |
| scriptIsExited | boolean | |
| uptime | number | |
##### NeoRuntime/Script/Create
??? info "Arguments"
| Name | Type | Description |
| ---------- | ------ | ------------------------------------- |
| scriptPath | string | Path of the new script, local/example |
??? info "Return"
| Name | Type | Description |
| ------ | ------- | --------------------- |
| res | boolean | success |
| resMsg | string | if fail, errorMessage |
##### NeoRuntime/Script/Delete
??? info "Arguments"
| Name | Type | Description |
| ---------- | ------ | ------------------------------------------- |
| scriptPath | string | Path of the script to delete, local/example |
??? info "Return"
| Name | Type | Description |
| ------ | ------- | --------------------- |
| res | boolean | success |
| resMsg | string | if fail, errorMessage |
##### NeoRuntime/Script/Select
??? info "Arguments"
| Name | Type | Description |
| ---------- | ------ | ------------------------------------------ |
| scriptPath | string | Path of the script to start, local/example |
##### NeoRuntime/Scripts/get
??? info "Return"
| Name | Type | Description |
| ------ | ------- | --------------------- |
| local | list | local scripts |
| remote | list | remote scripts |
### "Events"
```javascript
// Listen for a event
Socket.emit(event + "::join");
Socket.on(event, (*Return); => {
})
```
```javascript
// Stop listening for an event
Socket.emit(event + "::leave")
```
## Server
|