增加连接的connection_id

This commit is contained in:
2021-04-08 17:26:12 +08:00
parent fef46f3a0b
commit cf11a23a9d
5 changed files with 71 additions and 5 deletions

View File

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