Gorilla WebSocket WriteMessage 错误 - Go Lang

Gorilla WebSocket WriteMessage errors - Go Lang

我目前正在试验 Gorilla WebSocket 包。当使用 WriteMessage, if an error is returned, what should I do? Should I start the Closing Handshake or assume that if there is a problem it will be caught using the ReadMessage 方法发送消息并简单地记录错误时?

如果 WriteMessage return 出错,则应用程序应关闭连接。这会释放连接使用的资源并导致 reader 到 return 并出现错误。

WriteMessage return错误后无法发送关闭握手。如果 WriteMessage return 出错,则所有后续写入也将 return 出错。