ws服务的onclose监听该怎么做呢?如何做性能比较高 不占用太多资源呢?
```
// IsCloseError returns boolean indicating whether the error is a *CloseError
// with one of the specified codes.
func IsCloseError(err error, codes ...int) bool {
if e, ok := err.(*CloseError); ok {
for _, code := range codes {
if e.Code == code {
return true
}
}
}
return false
}
```
可以点进去看看 https://sourcegraph.com/github.com/gorilla/websocket@master/-/blob/conn_test.go#L621
#1