+
+ + +
+
+
+ +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+ + + +

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: +
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    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. +
  3. Then the user can authenticate like this: +
    1
    +2
    +3
    +4
    +5
    +6
    +7
    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.
    +});
    +
    +
  4. +
  5. We are now authenticated, and all actions and events are available to the client.
  6. +
+

"Actions"

+
1
+2
Socket.emit(Action, *Arguments, (Return) => {
+};)
+
+
+ +
NeoRuntime/status
+ + + + + + + + + + + + + + + +
NameTypeDescription
statusobject
+
Return/status + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
currentScriptstring"None"/Name of current script
scriptIsExitedboolean
uptimenumber
+
+
NeoRuntime/Script/Create
+
Arguments + + + + + + + + + + + + + + +
NameTypeDescription
scriptPathstringPath of the new script, local/example
+
+
Return + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
resbooleansuccess
resMsgstringif fail, errorMessage
+
+
NeoRuntime/Script/Delete
+
Arguments + + + + + + + + + + + + + + +
NameTypeDescription
scriptPathstringPath of the script to delete, local/example
+
+
Return + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
resbooleansuccess
resMsgstringif fail, errorMessage
+
+
NeoRuntime/Script/Select
+
Arguments + + + + + + + + + + + + + + +
NameTypeDescription
scriptPathstringPath of the script to start, local/example
+
+
NeoRuntime/Scripts/get
+
Return + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
locallistlocal scripts
remotelistremote scripts
+
+

"Events"

+

1
+2
+3
+4
+5
// Listen for a event
+Socket.emit(event + "::join");
+Socket.on(event, (*Return); => {
+
+})
+
+
+
1
+2
// Stop listening for an event
+Socket.emit(event + "::leave")
+
+

+

Server

+ + + + + + + + + +
+
+
+