mirror of
https://github.com/sbrl/Nibriboard.git
synced 2018-01-10 21:33:49 +00:00
Update connection to be ip address agnostic
This commit is contained in:
parent
0498b5ad9a
commit
19412e4361
3 changed files with 20 additions and 16 deletions
|
@ -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;
|
||||
/// <summary>
|
||||
/// Whether the WebSocket is secure.
|
||||
/// </summary>
|
||||
public bool SecureWebSocket = false;
|
||||
|
||||
/// <summary>
|
||||
/// The protocol to use over the WebSocket.
|
||||
/// </summary>
|
||||
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()
|
||||
{
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue