parent
c34f9cdda6
commit
6fe83917dd
|
@ -237,9 +237,10 @@ func WSHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
input := map[string]interface{}{}
|
input := map[string]interface{}{}
|
||||||
|
|
||||||
wsChan.Conn.SetReadDeadline(time.Now().Add(60 * time.Second))
|
wsChan.Conn.SetReadDeadline(time.Now().Add(pongWait))
|
||||||
wsChan.Conn.SetPongHandler(func(string) error { wsChan.Conn.SetReadDeadline(time.Now().Add(pongWait)); return nil })
|
wsChan.Conn.SetPongHandler(func(string) error { wsChan.Conn.SetReadDeadline(time.Now().Add(pongWait)); return nil })
|
||||||
ticker := time.NewTicker(pingPeriod)
|
ticker := time.NewTicker(pingPeriod)
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
WideSessions.Remove(sid)
|
WideSessions.Remove(sid)
|
||||||
ticker.Stop()
|
ticker.Stop()
|
||||||
|
@ -260,7 +261,6 @@ func WSHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}(ticker, wsChan)
|
}(ticker, wsChan)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
|
|
||||||
if err := wsChan.ReadJSON(&input); err != nil {
|
if err := wsChan.ReadJSON(&input); err != nil {
|
||||||
logger.Tracef("[Session Channel] of session [%s] disconnected, releases all resources with it, user [%s]", sid, wSession.Username)
|
logger.Tracef("[Session Channel] of session [%s] disconnected, releases all resources with it, user [%s]", sid, wSession.Username)
|
||||||
|
|
||||||
|
@ -277,7 +277,6 @@ func WSHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
wsChan.Time = time.Now()
|
wsChan.Time = time.Now()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SaveContentHandler handles request of session content string.
|
// SaveContentHandler handles request of session content string.
|
||||||
|
|
Loading…
Reference in New Issue