lxzan / gws

simple, fast, reliable websocket server & client, supports running over tcp/kcp/unix domain socket. keywords: ws, proxy, chat, go, golang...
https://pkg.go.dev/github.com/lxzan/gws
Apache License 2.0
1.36k stars 87 forks source link

fix: put message to sync.pool #17

Closed rfyiamcool closed 1 year ago

rfyiamcool commented 1 year ago

what

after onMeesage(), put message object to sync.pool.

code : examples/client/client.go

func (c *WebSocket) OnMessage(socket *gws.Conn, message *gws.Message) {
+   defer message.Close()
    fmt.Printf("recv: %s\n", message.Data.String())
}
lxzan commented 1 year ago

PR先提到dev分支吧. 你是受不了golint的报错了吗😂

rfyiamcool commented 1 year ago

PR先提到dev分支吧. 你是受不了golint的报错了吗😂

哈哈,看 example 的时候,看到 client onMessage 没有返还到池子里,就修了下。正好 lint 有报错,我看你 example 里有的适配了,有些没适配,我就顺手给改了。

rfyiamcool commented 1 year ago

你是不是需要先把 dev 并成最新的?😁

lxzan commented 1 year ago

现在是最新的了

rfyiamcool commented 1 year ago

现在是最新的了

done 😁