diff --git a/Nibriboard/Client/ClientSettings.cs b/Nibriboard/Client/ClientSettings.cs index 0a91469..22a1872 100644 --- a/Nibriboard/Client/ClientSettings.cs +++ b/Nibriboard/Client/ClientSettings.cs @@ -5,23 +5,26 @@ namespace Nibriboard.Client { public class ClientSettings { - [JsonIgnore] - public bool SecureWebsocket = false; - [JsonIgnore] - public int WebsocketPort; - [JsonIgnore] - public string WebsocketHost = "localhost"; - [JsonIgnore] - public string WebsocketPath; + /// + /// Whether the WebSocket is secure. + /// + public bool SecureWebSocket = false; + + /// + /// The protocol to use over the WebSocket. + /// + public string WebsocketProtocol = "RippleLink"; + + public int WebSocketPort; + public string WebSocketHost = "localhost"; + public string WebSocketPath; public string WebsocketUri { get { - return (SecureWebsocket ? "wss" : "ws") + $"://{WebsocketHost}:{WebsocketPort}{WebsocketPath}"; + return (SecureWebSocket ? "wss" : "ws") + $"://{WebSocketHost}:{WebSocketPort}{WebSocketPath}"; } } - public string WebsocketProtocol = "RippleLink"; - public ClientSettings() { diff --git a/Nibriboard/ClientFiles/BoardWindow.js b/Nibriboard/ClientFiles/BoardWindow.js index 11e0570..695ffc3 100644 --- a/Nibriboard/ClientFiles/BoardWindow.js +++ b/Nibriboard/ClientFiles/BoardWindow.js @@ -148,7 +148,7 @@ class BoardWindow extends EventEmitter * This mainly consists of establishing the RippleLink connection to the server. */ setup() { - this.rippleLink = new RippleLink(this.settings.WebsocketUri, this); + this.rippleLink = new RippleLink(`ws${this.settings.SecureWebSocket ? "s" : ""}://${location.host}/${this.settings.WebSocketPath}`, this); this.rippleLink.on("connect", (function(event) { // Send the handshake request diff --git a/Nibriboard/NibriboardServer.cs b/Nibriboard/NibriboardServer.cs index ba65810..c599a48 100644 --- a/Nibriboard/NibriboardServer.cs +++ b/Nibriboard/NibriboardServer.cs @@ -31,9 +31,10 @@ namespace Nibriboard Port = inPort; clientSettings = new ClientSettings() { - WebsocketHost = "192.168.0.56", - WebsocketPort = Port, - WebsocketPath = "/RipplespaceLink" + SecureWebSocket = false, + WebSocketHost = "192.168.0.56", + WebSocketPort = Port, + WebSocketPath = "/RipplespaceLink" }; // HTTP Server setup @@ -59,7 +60,7 @@ namespace Nibriboard clientManagerCanceller.Token ); httpServer.AddWebSocketRequestHandler( - clientSettings.WebsocketPath, + clientSettings.WebSocketPath, clientManager );