Open Karrrrrrrr opened 1 year ago
if I have some runtime error in hooks(OnConnect function or any other), this program will abort so how to save program not abort
package main import ( "github.com/gin-gonic/gin" "github.com/gorilla/websocket" "github.com/kataras/neffos" "github.com/kataras/neffos/gorilla" "net/http" ) const ( namespace = "default" timeout = 0 // 30 * time.Second ) var handler = neffos.WithTimeout{ ReadTimeout: timeout, WriteTimeout: timeout, Namespaces: neffos.Namespaces{ namespace: neffos.Events{}, }, } func main() { upgrader := gorilla.Upgrader(websocket.Upgrader{CheckOrigin: func(r *http.Request) bool { return true }}) server(upgrader) } func server(upgrader neffos.Upgrader) { srv := neffos.New(upgrader, handler) srv.OnConnect = func(c *neffos.Conn) error { var i *int *i = 1 // this process will abort at this // so how to continue and recover process return nil } app := gin.New() app.GET("/echo", gin.WrapH(srv)) app.Run() }
if I have some runtime error in hooks(OnConnect function or any other), this program will abort so how to save program not abort