Ejemplo n.º 1
0
 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));
         }
     }
 }
Ejemplo n.º 2
0
        //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);
        }
Ejemplo n.º 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));
 }
Ejemplo n.º 4
0
 protected override void OnClose(CloseEventArgs e)
 {
     LogRecord.Info("BasicWebSocketBehavior", string.Format("Socket Client Closed:{0}", endPoint));
     base.OnClose(e);
 }
Ejemplo n.º 5
0
 public override void OnOpen()
 {
     base.OnOpen();
     endPoint = Context.Connection.RemoteIpAddress;
     LogRecord.Info("BasicWebSocketBehavior", string.Format("Socket Client Connect:{0}", endPoint));
 }