go-socket.io
go-socket.io copied to clipboard
Remove panic from source code
I don't think removing panic is reasonable. It's useful when parsing/unparsing.
I know to it. Panic use only in handler.go file. At now, we use f interface{} at parameter at newEventFunc and newAckFunc i think it is not best way. Because user caught panic at runtime. We may use new type HandlerFunc as gin-gonic way, because we used four signature at OnEvent in practice func(s socketio.Conn, msg string), func(s socketio.Conn, msg string) string, func(s socketio.Conn) string. I suggest all callback use as func (c socketio.Context). Remaining handlers similar callback at OnEvent handlers.
But we need refactor all source code to integrate my suggest. It theme linked with this issue
Panic code:
That's fine. So the feature is to make a register function with a context instead of interface{}, but not remove panic.
I think to making another issue and giving some background would be better.
Or, shall we dup this to #275?