private void timer2_Tick(object sender, EventArgs e) { var msgFactory = new OpenApiMessagesFactory(); var msg = msgFactory.CreateHeartbeatEvent(); Transmit(msg, false); }
static void SendHeartbeatEvent(OpenApiMessagesFactory msgFactory, Queue writeQueue) { var _msg = msgFactory.CreateHeartbeatEvent(); if (isDebugIsOn) { Console.WriteLine("SendHeartbeatEvent() Message to be send:\n{0}", OpenApiMessagesPresentation.ToString(_msg)); } writeQueue.Enqueue(Utils.Serialize(_msg)); }
void SendHeartbeatEvent(OpenApiMessagesFactory msgFactory, Queue writeQueue) { var _msg = msgFactory.CreateHeartbeatEvent(); #if TRACE_HEARTBEAT if (isDebugIsOn) { Console.WriteLine("SendHeartbeatEvent() Message to be sent:\n{0}", OpenApiMessagesPresentation.ToString(_msg)); } #endif writeQueue.Enqueue(_msg.ToByteArray()); }
private void HeartBeat(object obj, System.Timers.ElapsedEventArgs e) { //keep connection alive with a heartbeat atleast every 10 seconds var msgFactory = new OpenApiMessagesFactory(); var msg = msgFactory.CreateHeartbeatEvent(); _trasmitQueue.Enqueue(msg); //stop the timer if the connection has died if (isShutdown) { _heartbeatTimer.Stop(); } }