增加服务退出时, finish hook支持

This commit is contained in:
2021-11-17 18:54:34 +08:00
parent 2101bda75c
commit 19cb3e3ddf
2 changed files with 9 additions and 6 deletions

View File

@ -23,7 +23,7 @@ import (
)
func main() {
websocket.NewWebsocketServe(&Example{})
_ = websocket.NewWebsocketServe(nil, &Example{})
}
type Example struct {
@ -31,7 +31,7 @@ type Example struct {
func (e Example) Connect(ctx *context.WSContext) error {
fmt.Println("建立连接成功")
message.Response(ctx, map[string]interface{}{"say": "hello world!", "cid": ctx.ConnectionID})
_ = message.Response(ctx, map[string]interface{}{"say": "hello world!", "cid": ctx.ConnectionID})
return nil
}