protected virtual void WebSocketOnMessage(object sender, MessageEventArgs e) { try { OnReceiveMessage(webSocket, e); } catch (Exception ex) { LogRecord.Error("StompWebSocketMaketClientBase", $"{Name} receive message error {ex}."); } }
protected virtual bool StompConnect() { try { StompConnect(webSocket); return(true); } catch (Exception ex) { LogRecord.Error("StompWebSocketMaketClientBase", $"{Name} subscribe symbols error {ex}."); } return(false); }
//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); }
protected virtual void WebSocketOnError(object sender, ErrorEventArgs e) { LogRecord.Error("StompWebSocketMaketClientBase", $"{Name} has error:{e.Exception}."); }
protected virtual void WebSocketOnClosed(object sender, CloseEventArgs e) { LogRecord.Error("StompWebSocketMaketClientBase", $"{Name} was closed."); }