Skip to content

//okhttp/okhttp3/WebSocket/send

send

[jvm]\ abstract fun send(text: String): Boolean

Attempts to enqueue text to be UTF-8 encoded and sent as a the data of a text (type 0x1) message.

This method returns true if the message was enqueued. Messages that would overflow the outgoing message buffer will be rejected and trigger a graceful shutdown of this web socket. This method returns false in that case, and in any other case where this web socket is closing, closed, or canceled.

This method returns immediately.

[jvm]\ abstract fun send(bytes: ByteString): Boolean

Attempts to enqueue bytes to be sent as a the data of a binary (type 0x2) message.

This method returns true if the message was enqueued. Messages that would overflow the outgoing message buffer (16 MiB) will be rejected and trigger a graceful shutdown of this web socket. This method returns false in that case, and in any other case where this web socket is closing, closed, or canceled.

This method returns immediately.