Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct outgoing message queue threading #22

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Disabled heartbeat timer in websocket layer and in socket.io layer if…
… the provided interval is equal to zero
  • Loading branch information
AdamFoley committed Jul 16, 2014
commit 9edf52b83d20b3f9420f98884383b5e4383a3b32
8 changes: 6 additions & 2 deletions SocketIO/socketio/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ public void Connect(string query, string[] headers)
string.Format("{0}://{1}:{2}/socket.io/1/websocket/{3}", wsScheme, uri.Host, uri.Port, this.HandShake.SID),
string.Empty,
this.socketVersion);
this.wsClient.EnableAutoSendPing = true; // #4 tkiley: Websocket4net client library initiates a websocket heartbeat, causes delivery problems
//this.wsClient.EnableAutoSendPing = true; // #4 tkiley: Websocket4net client library initiates a websocket heartbeat, causes delivery problems
this.wsClient.EnableAutoSendPing = false; // ANF: socket.io has it's own heartbeat, this should be unnecessary
this.wsClient.Opened += this.wsClient_OpenEvent;
this.wsClient.MessageReceived += this.wsClient_MessageReceived;
this.wsClient.Error += this.wsClient_Error;
Expand Down Expand Up @@ -410,7 +411,10 @@ protected void closeWebSocketClient()
// websocket client events - open, messages, errors, closing
private void wsClient_OpenEvent(object sender, EventArgs e)
{
this.socketHeartBeatTimer = new Timer(OnHeartBeatTimerCallback, new object(), HandShake.HeartbeatInterval, HandShake.HeartbeatInterval);
// ANF: only enable the heartbeat timer if the interval is non-zero
if(HandShake.HeartbeatInterval.TotalMilliseconds!=(double)0.0)
this.socketHeartBeatTimer = new Timer(OnHeartBeatTimerCallback, new object(), HandShake.HeartbeatInterval, HandShake.HeartbeatInterval);

this.ConnectionOpenEvent.Set();

this.OnMessageEvent(new EventMessage() { Event = "open" });
Expand Down