canSend

abstract val canSend: Boolean(source)

If false, sending frames should not be attempted and will likely throw an exception. If true, sending frames will likely succeed. However, no guarantees can be made because there could be a race condition between WS closure and a "send" call.

This is usually based on the underlying web socket implementation "closed for send" status. However, some web socket implementations like OkHttp or iOS don't expose their status, and canSend always returns true. Note that OkHttp always allows calls to its send methods (which are turned into no-ops when the web socket is closed).