-
+
+
-
+ +
-
-
+ +
-
-
-
- - + +
+
-

SocketIO

+ + + +

SocketIO

Client

-

Socketio is setup in the file globals. -This means, import globals, and then you can use Socket from there.

+

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. +
    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);
    +};)
    +
  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. +
    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.
    +});
    +
  5. We are now authenticated, and all actions and events are available to the client.

"Actions"

-
1
-2
Socket.emit(Action, *Arguments, (Return) => {
-};)
-
-
- +
Socket.emit(Action, *Arguments, (Return) => {
+};)
+
NeoRuntime/status
@@ -747,7 +700,9 @@ This means, import globals
-
Return/status +
+Return/status +
@@ -775,7 +730,9 @@ This means, import globals
NeoRuntime/Script/Create
-
Arguments
Name
+
+Arguments +
@@ -792,7 +749,9 @@ This means, import globals
Name
-
Return +
+Return +
@@ -815,7 +774,9 @@ This means, import globals
NeoRuntime/Script/Delete
-
Arguments
Name
+
+Arguments +
@@ -832,7 +793,9 @@ This means, import globals
Name
-
Return +
+Return +
@@ -855,7 +818,9 @@ This means, import globals
NeoRuntime/Script/Select
-
Arguments
Name
+
+Arguments +
@@ -873,7 +838,9 @@ This means, import globals
NeoRuntime/Scripts/get
-
Return
Name
+
+Return +
@@ -896,81 +863,78 @@ This means, import globals

"Events"

-

Name
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")
-
-

+

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

Server

- - - - - - - -
-
+ + + + +
+
+ +
+
- -
+ + + +