增加对当前连接发送消息的方法

This commit is contained in:
2021-03-28 17:21:47 +08:00
parent c41a7c4671
commit fef46f3a0b
2 changed files with 27 additions and 0 deletions

View File

@ -10,6 +10,8 @@ package main
import (
"fmt"
"github.com/go-developer/websocket/message"
"github.com/go-developer/websocket"
"github.com/go-developer/websocket/abstract"
"github.com/go-developer/websocket/context"
@ -24,6 +26,7 @@ type Example struct {
func (e Example) Connect(ctx *context.WSContext) {
fmt.Println("建立连接成功")
message.Response(ctx, map[string]interface{}{"say": "hello world!"})
}
func (e Example) Disconnect(ctx *context.WSContext) {