Last post Aug 07, 2013 03:52 AM by Ruchira
Jun 28, 2013 02:31 PM|piyushshankar|LINK
I recently read about SignalR and willing to use it for a project. My project requirement is to display real time alerts of production floor on web browser. I can see Signal R as the best solution available for my need. I have experimented lot of examples
using SignalR libraries and everything seems to work great. I have one question that I couldn't find answers anywhere.
In our production deployment, SignalR transport would most likely be long polling. Machine alerts will come only when something goes wrong in the production and that may occur after several minutes or hours. Now if my client browser is open waiting for alerts
with a Signal R connection would it timeout after a long idle period? and never reconnect automatically? If that is true what is the configuration I can set to have client connection open indefinetely or reconnect whenever server has an alert.
Jun 29, 2013 03:30 AM|Ruchira|LINK
Welcome to the ASP.NET forums!
Now if my client browser is open waiting for alerts with a Signal R connection would it timeout after a long idle period?
No. As long as the webpage is kept open, there will be a persistent connection between the client and the server.
and never reconnect automatically?
Timeout only happens while connecting. If the connection fails, then it will try to reconnect.
Please 'Mark as Answer' if this post helps you
Jul 03, 2013 08:59 PM|piyushshankar|LINK
Recently I experienced an issue in my application. Whenever I add a new connection to a group and immediately respond to the newly added client by calling a function on the client, I see that client doesn't receive message. However, if I put a small sleep
on server side and then call the client function it works fine.
Just to give you more details these are the sequence of steps
with above sequence the newly added client doesn't receive "hello" message. However if I put a Thread.Sleep(3000); before calling client function it works.
Is this an expected behaviour?
Jul 03, 2013 09:16 PM|davidfowl|LINK
Groups.Add(...) is async so to write that code you'd need to use await or if you want to block then use Wait():
await Groups.Add(connectionId, "Foo");
Jul 12, 2013 07:49 PM|piyushshankar|LINK
As per your response, I was hoping that client will never be disconnected once a persistent connection is established. Today I got an error after my browser was idle for sometime. After 15-20 minutes of idle time I clicked a button on my webpage that calls
a server method on hub and I saw error on console that "not connected so can't call this method".
Also, what is this message that I see on console it says a timeout for connection.
[18:42:20.436] [18:42:20 GMT-0500 (Central Standard Time)] SignalR: Now monitoring keep alive with a warning timeout of 13333.333333333332 and a connection lost timeout of 20000
Thanks for your help
Jul 13, 2013 12:58 AM|Ruchira|LINK
Check the below answer from David
Jul 16, 2013 01:28 PM|davidfowl|LINK
Check out the documentation on how to reconnect forever:
Aug 06, 2013 09:00 PM|piyushshankar|LINK
My client runs on Android device and sometimes due to poor wifi, it loses connection but automatically reconnects.
In my application I maintain a list of connected clients and a background thread cleans up objects and database connections when there are no clients connected to a specific group.
Cancelled exception" when this line is executed which is trying to re-add connection to group.
this.Groups.Add(Context.ConnectionId, groupName).Wait(); Is it because on reconnect connection id is
same and is already in the group?
Aug 07, 2013 03:52 AM|Ruchira|LINK
this.Groups.Add(Context.ConnectionId, groupName).Wait(); Is it because on reconnect connection id is same
and is already in the group?
On reconnection, the client will automatically be added to the groups and the connection ID would be same. No need to add to the groups again.