webSockets connection become connected before server OnConnectedAsync complete #1257

Xiaohongt opened this Issue Jan 8, 2013 · 2 comments


None yet
4 participants

Xiaohongt commented Jan 8, 2013

e.g. in server:
OnConnectedAsync event:
protected override async Task OnConnectedAsync(IRequest request, string connectionId)
await Groups.Add(connectionId, "group1");
await Groups.Add(connectionId, "group2");
await Groups.Add(connectionId, "group3");

OnReceivedAsync event:
protected override Task OnReceivedAsync(IRequest request, string connectionId, string data)
Groups.Send("group1", "group1");
Groups.Send("group2", "group2");
Groups.Send("group3", "group3");
return base.OnReceivedAsync(request, connectionId, data);

when client webSockets connection is connected and send message to server, server OnReceivedAsync get called, in this case OnConnectedAsync could still not complete, the group2 or group3 could still not added in group, so the Groups.Send("group2", "group2") or Groups.Send("group3", "group3") couldn't make to client.

halter73 was assigned Jan 10, 2013


DamianEdwards commented Jan 11, 2013

We can fix this by sending an "init" payload on connect similar to the serverSentEvents transport and not raising connect in the client until that payload is received. Not critical for 1.0 RTW.


davidfowl commented May 4, 2013

Closing this as a dupe of #1984

davidfowl closed this May 4, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment