public override Task OnDisconnected(bool stopCalled) { // 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. SyncHub.SendMessage("Server", "Client disconnected"); return(base.OnDisconnected(stopCalled)); }
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. //Hämta användarens namn ur requesten var name = Context.QueryString["username"]; //Skicka meddelande om att personen anslutit. SyncHub.SendMessage("Server", $"{name} connected"); //Skicka en uppdaterad lista till användarna. SendListUpdate(); return(base.OnConnected()); }