Flushes all outstanding messages and suspends until all earlier sent messages will be written. Could be called at any time even after close. May return immediately if the connection is already terminated. However, it may also fail with an exception (or cancellation) at any point due to a session failure. Note that flush doesn't guarantee that frames were actually delivered.
Enqueue a frame, may suspend if an outgoing queue is full. May throw an exception if the outgoing channel is already closed, so it is impossible to transfer any message. Frames that were sent after close frame could be silently ignored. Note that a close frame could be sent automatically in reply to a peer's close frame unless it is raw WebSocket session.
An incoming frames channel. Note that if you use webSocket to handle a WebSockets session, the incoming channel doesn't contain control frames such as the ping/pong or close frames. If you need control over control frames, use the webSocketRaw function.
Enables or disables masking output messages by a random XOR mask. Note that changing this flag on the fly could be applied to the messages already sent (enqueued earlier) as the sending pipeline works asynchronously.
An outgoing frames channel. It could have limited capacity so sending too many frames may lead to suspension at corresponding send invocations. It also may suspend if a peer doesn't read frames for some reason.
Sends a close frame with the specified reason. May suspend if the outgoing channel is full. The specified reason could be ignored if there was already close frame sent (for example in reply to a peer close frame). It also may do nothing when a session or an outgoing channel is already closed due to any reason.