public EventHandler(Main plugin) { this.plugin = plugin; if (plugin.GetConfigBool("srvnamevars_WebSocketServer_Enabled")) { ushort port; if (!ushort.TryParse(plugin.GetConfigInt("srvnamevars_WebSocketServer_Port").ToString(), out port)) { plugin.Error("Invalid port number specified in config file."); return; } if (port <= 2000) { plugin.Error("Invalid port number specified in config file."); return; } plugin.Info("attempting to start websocket server..."); try { wssvr = new WebsocketServer(this, port, plugin.GetConfigString("srvnamevars_WebSocketServer_ServiceName")); } catch { plugin.Error("Failed to start websocket server! (are you missing the dependency dll?)"); } } }
public sockserv(EventHandler eventHandler, WebsocketServer websocketServer) { this.EventHandler = eventHandler; websocketServer.sockserv = this; }