优化建立连接

This commit is contained in:
2021-04-09 15:13:22 +08:00
parent 9b826dfae7
commit 87f0a26e5e
3 changed files with 16 additions and 5 deletions

View File

@ -24,9 +24,10 @@ func main() {
type Example struct {
}
func (e Example) Connect(ctx *context.WSContext) {
func (e Example) Connect(ctx *context.WSContext) error {
fmt.Println("建立连接成功")
message.Response(ctx, map[string]interface{}{"say": "hello world!", "cid": ctx.ConnectionID})
return nil
}
func (e Example) Disconnect(ctx *context.WSContext) {