1
0
mirror of https://github.com/bingohuang/docker-labs.git synced 2025-07-14 01:57:32 +08:00

Avoid app crash if WS handler panics

This commit is contained in:
Marcos Lilljedahl 2016-11-13 21:56:19 -03:00
parent 27dd5d6f7b
commit 2450d53eeb

View File

@ -1,6 +1,7 @@
package handlers
import (
"fmt"
"log"
"github.com/franela/play-with-docker/services"
@ -9,6 +10,11 @@ import (
)
func WS(so socketio.Socket) {
defer func() {
if r := recover(); r != nil {
fmt.Println("Recovered from ", r)
}
}()
vars := mux.Vars(so.Request())
sessionId := vars["sessionId"]