mirror of
https://github.com/PepperDash/PepperDashCore.git
synced 2026-04-13 20:46:34 +00:00
fix: Adds url property and utilizes private _path for consistency
This commit is contained in:
parent
40f540e23a
commit
19032a0f6d
1 changed files with 14 additions and 7 deletions
|
|
@ -22,7 +22,7 @@ namespace PepperDash.Core
|
||||||
{
|
{
|
||||||
private HttpServer _httpsServer;
|
private HttpServer _httpsServer;
|
||||||
|
|
||||||
private string _path = "/join";
|
private string _path = "/debug/join/";
|
||||||
private const string _certificateName = "selfCres";
|
private const string _certificateName = "selfCres";
|
||||||
private const string _certificatePassword = "cres12345";
|
private const string _certificatePassword = "cres12345";
|
||||||
|
|
||||||
|
|
@ -35,6 +35,15 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string Url
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_httpsServer == null) return "";
|
||||||
|
return $"wss://{_httpsServer.Address}:{_httpsServer.Port}{_httpsServer.WebSocketServices[_path].Path}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool IsRunning { get => _httpsServer?.IsListening ?? false; }
|
public bool IsRunning { get => _httpsServer?.IsListening ?? false; }
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -112,17 +121,15 @@ namespace PepperDash.Core
|
||||||
Debug.Console(0, "Starting Websocket Server on port: {0}", port);
|
Debug.Console(0, "Starting Websocket Server on port: {0}", port);
|
||||||
|
|
||||||
|
|
||||||
Start(port, $"\\user\\{_certificateName}.pfx", _certificatePassword, @"");
|
Start(port, $"\\user\\{_certificateName}.pfx", _certificatePassword, @"/");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Start(int port, string certPath = "", string certPassword = "", string rootPath = @"/html")
|
private void Start(int port, string certPath = "", string certPassword = "", string rootPath = @"/html")
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_httpsServer = new HttpServer(port, true)
|
_httpsServer = new HttpServer(port, true);
|
||||||
{
|
|
||||||
RootPath = rootPath
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(certPath))
|
if (!string.IsNullOrWhiteSpace(certPath))
|
||||||
{
|
{
|
||||||
|
|
@ -141,7 +148,7 @@ namespace PepperDash.Core
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
Debug.Console(0, "Adding Debug Client Service");
|
Debug.Console(0, "Adding Debug Client Service");
|
||||||
_httpsServer.AddWebSocketService<DebugClient>("/debug/join");
|
_httpsServer.AddWebSocketService<DebugClient>(_path);
|
||||||
Debug.Console(0, "Assigning Log Info");
|
Debug.Console(0, "Assigning Log Info");
|
||||||
_httpsServer.Log.Level = LogLevel.Trace;
|
_httpsServer.Log.Level = LogLevel.Trace;
|
||||||
_httpsServer.Log.Output = (d, s) =>
|
_httpsServer.Log.Output = (d, s) =>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue