public void Start()
 {
     Server.Start();
     if (Server.ServiceHosts != null && Server.ServiceHosts.Count > 0)
     {
         foreach (KeyValuePair <string, WebSocketServiceHost> serviceHost in Server.ServiceHosts)
         {
             LogRecord.Info("MultiPathBroadcastService", string.Format("Service Start. Listen:{0}", listenUrl + serviceHost.Key));
         }
     }
 }
        //private int pingInterval = 30000;
        //public int PingInterval
        //{
        //    get
        //    {
        //        return this.pingInterval;
        //    }
        //    set
        //    {
        //        this.pingInterval = value;
        //        if (this.timer != null)
        //            this.timer.Interval = value;
        //    }
        //}

        protected virtual bool SubscribeSymbols()
        {
            try
            {
                IEnumerable <string> topics = GetSubscribeTopics();
                if (topics != null && topics.Any())
                {
                    foreach (string t in topics)
                    {
                        LogRecord.Info("StompWebSocketMaketClientBase", $"{Name} begin subscribe {t}");
                        SubscribeTopic(webSocket, t);
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                LogRecord.Error("StompWebSocketMaketClientBase", $"{Name} subscribe symbols error {ex}.");
            }
            return(false);
        }
Exemple #3
0
 protected override void OnError(ErrorEventArgs e)
 {
     base.OnError(e);
     LogRecord.Info("BasicWebSocketBehavior", string.Format("Socket Client Error:{0}.\r\nException:{1}\r\nMessage:", endPoint, e.Exception, e.Message));
 }
Exemple #4
0
 protected override void OnClose(CloseEventArgs e)
 {
     LogRecord.Info("BasicWebSocketBehavior", string.Format("Socket Client Closed:{0}", endPoint));
     base.OnClose(e);
 }
Exemple #5
0
 public override void OnOpen()
 {
     base.OnOpen();
     endPoint = Context.Connection.RemoteIpAddress;
     LogRecord.Info("BasicWebSocketBehavior", string.Format("Socket Client Connect:{0}", endPoint));
 }