Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strike>If a user refreshes the page, that is treated as a new connection. You are correct that the disconnect is based on a timeout. </p> <p>You can handle the Connect/Reconnect and Disconnect events in a Hub by implementing <code>SignalR.Hubs.IConnected</code> and <code>SignalR.Hubs.IDisconnect</code>.</strike></p> <p>The above referred to SignalR 0.5.x. </p> <p>From <a href="http://www.asp.net/signalr/overview/hubs-api/hubs-api-guide-server#connectionlifetime" rel="nofollow">the official documentation</a> (currently for v1.1.3):</p> <pre><code>public class ContosoChatHub : Hub { public override Task OnConnected() { // Add your own code here. // For example: in a chat application, record the association between // the current connection ID and user name, and mark the user as online. // After the code in this method completes, the client is informed that // the connection is established; for example, in a JavaScript client, // the start().done callback is executed. return base.OnConnected(); } public override Task OnDisconnected() { // Add your own code here. // For example: in a chat application, mark the user as offline, // delete the association between the current connection id and user name. return base.OnDisconnected(); } public override Task OnReconnected() { // Add your own code here. // For example: in a chat application, you might have marked the // user as offline after a period of inactivity; in that case // mark the user as online again. return base.OnReconnected(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload