mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-14 15:24:52 +09:00
Replace socket.io with plain WebSocket
Replace socket.io with plain WebSocket using the ws library as it doesn't really provide any useful tools over plain WebSocket when it comes to implementing reliable communication that works across reconnects. The widespread browser support for WebSocket also means it has little value to add for the web interface over WebSocket.
This commit is contained in:
1 parent
808bd6b453
commit
677512512e
12 files changed
+139
-149
No files matched your search
+8
-4
@@ -1,4 +1,3 @@
|
||||
const io = require("socket.io-client");
|
||||
const jwt = require("jsonwebtoken");
|
||||
const fs = require("fs-extra");
|
||||
const yargs = require("yargs");
|
||||
@@ -315,10 +314,16 @@ commands = new Map([...commands.map(command => [command.name, command])]);
|
||||
/**
|
||||
* Connector for control connection to master server
|
||||
*/
|
||||
class ControlConnector extends link.SocketIOClientConnector {
|
||||
class ControlConnector extends link.WebSocketClientConnector {
|
||||
constructor(url, token) {
|
||||
super(url);
|
||||
this._token = token;
|
||||
}
|
||||
|
||||
register() {
|
||||
console.log("SOCKET | registering control");
|
||||
this.send('register_control', {
|
||||
token: this._token,
|
||||
agent: 'clusterctl',
|
||||
version: version,
|
||||
});
|
||||
@@ -328,8 +333,7 @@ class ControlConnector extends link.SocketIOClientConnector {
|
||||
/**
|
||||
* Handles running the control
|
||||
*
|
||||
* Connects to the master server over the socket.io connection and sends
|
||||
* commands to it.
|
||||
* Connects to the master server over WebSocket and sends commands to it.
|
||||
*/
|
||||
class Control extends link.Link {
|
||||
|
||||
|
||||
Reference in new issue
Block a user