/* * public static CommandController Commands * { * get * { * return socketServer.CommandController; * } * } */ static CoflnetSocket() { socketServer = new WebSocketServer(8080, sslEnabled); socketServer.Log.Level = LogLevel.Trace; // wssv.Log.Output = Logger.Log; //socketServer = new CoflnetWebsocketServer(); //socketServer.CommandController.RegisterCommand("setAge", SetAge); socketServer.AddWebSocketService <CoflnetWebsocketServer>("/socket", (s) => { s.Protocol = "dev"; CoflnetSocket.Instance.server = s; }); if (socketServer.IsSecure) { socketServer.SslConfiguration.ServerCertificate = new X509Certificate2("/home/ekwav/dev/ssl/cert.pfx", "adh3o8UBIZUZHBTTUZIUgvghHU"); } socketServer.Start(); Instance = new CoflnetSocket(); }
public override void SendCommand(CommandData data, long serverId = 0) { if (CoflnetSocket.TrySendCommand(data, serverId)) { return; } // Command couldn't be sent we have to persist it MessagePersistence.ServerInstance.SaveMessage(data); }