解释SetWriteDeadline错误

I am writing a websocket server in Go that broadcasts messages to clients. I use SetWriteDeadline on each send so that the broadcast loop doesn't get stuck.

My question is: how do I interpret an error from SetWriteDeadline? In particular, should I assume that there is something wrong with that particular client and unregister it? Or is it a server-side issue that happened to get triggered on this client?

After researching SetWriteDeadline, I found that the deadline is for putting the message on the TCP stack server-side, not for the client to receive the message. So perhaps a better way to phrase my question is this: is there a separate TCP stack for each websocket client (perhaps this is the thing that has size WriteBufferSize), or is this buffer shared between clients? In the former case it seems like I should unregister the client on a SetWriteDeadline error, but not in the latter case.

Websocket connections are independent of other websocket connections.

Websocket connections have an underlying network connection. These network connections are also independent of each other.

An error returned from SetWriteDeadline indicates a problem with that specific websocket connection or the websocket connection's underlying network connection.

Also note that Gorilla's SetWriteDeadline method never returns an error.