public void Start(int port) {
_server = new WebServer($"http://+:{port}/", new NullLog(), RoutingStrategy.Wildcard);
_server.RegisterModule(new WebApiModule());
_server.Module<WebApiModule>().RegisterController<PlayerStatsController>();
var module = new WebSocketsModule();
_server.RegisterModule(module);
_currentServer = new PublishDataSocketsServer(@"Current Race Stats Server");
module.RegisterWebSocketsServer("/api/current", _currentServer);
try {
_server.RunAsync();
} catch (HttpListenerException e) {
Logging.Warning(e.Message + $"\nDon’t forget to reserve url using something like “netsh http add urlacl url=\"http://+:{port}/\" user=everyone”.");
} catch (Exception e) {
Logging.Error(e);
}
}