send

abstract suspend fun send(headers: StompSendHeaders, body: FrameBody?): StompReceipt?(source)

Sends a SEND frame to the server with the given headers and the given body.

Depending on the configuration, headers may be modified before sending the frame:

  • If no receipt header is provided and auto-receipt is enabled, a new unique receipt header is generated and added

  • If no content-length header is provided and autoContentLength is enabled, the content length is computed based on body size and added as content-length header

If a receipt header is present (automatically added or manually provided), this method suspends until the corresponding RECEIPT frame is received from the server. If no RECEIPT frame is received in the configured time limit, a LostReceiptException is thrown.

If auto-receipt is disabled and no receipt header is provided, this method doesn't wait for a RECEIPT frame and never throws LostReceiptException. Instead, it returns immediately after sending the SEND frame.

See the general StompSession documentation for more details about suspension and receipts.

Return

the StompReceipt received from the server if receipts are enabled, or null if receipts were not used

See also