Close shuts down the SockJS connection and sends the status code and reason to the client Can happen if the process exits or if there is an error starting up the process For now the status code is unused and reason is shown to the user (unless "")
(sessionId string, status uint32, reason string)
| 164 | // Can happen if the process exits or if there is an error starting up the process |
| 165 | // For now the status code is unused and reason is shown to the user (unless "") |
| 166 | func (sm *SessionMap) Close(sessionId string, status uint32, reason string) { |
| 167 | if _, ok := sm.Sessions[sessionId]; !ok { |
| 168 | return |
| 169 | } |
| 170 | sm.Lock.Lock() |
| 171 | defer sm.Lock.Unlock() |
| 172 | err := sm.Sessions[sessionId].sockJSSession.Close(status, reason) |
| 173 | if err != nil && status != 1 { |
| 174 | log.Println(err) |
| 175 | } |
| 176 | |
| 177 | delete(sm.Sessions, sessionId) |
| 178 | } |
| 179 | |
| 180 | // Clean all session when system logout |
| 181 | func (sm *SessionMap) Clean() { |