Sub Class_Globals
Private ws As WebSocket
Private txt, ChatTxt, Users, btnSend, btnLogout As JQueryElement
Private name As String
End Sub
Public Sub Initialize
End Sub
Private Sub WebSocket_Connected (WebSocket1 As WebSocket)
ws = WebSocket1
name = ws.Session.GetAttribute2("name", "")
If name = "" Then
'name not found. Go to the login page. This will happen if the user goes to the chat page directly.
WebUtils.RedirectTo(ws, "index.html")
Else
'remove the attribute
'the user will be redirected to the login page next time.
ws.Session.SetAttribute("name", "")
CallSubDelayed3(ChatShared, "NewConnection", Me, name)
txt.RunMethod("select", Null)
End If
End Sub