SSEServerTransport

class SSEServerTransport(endpoint: String, session: ServerSSESession) : Transport(source)

Server transport for SSE: this will send messages over an SSE connection and receive messages from HTTP POST requests.

Creates a new SSE server transport, which will direct the client to POST messages to the relative or absolute URL identified by _endpoint.

Constructors

Link copied to clipboard
constructor(endpoint: String, session: ServerSSESession)

Properties

Link copied to clipboard
open override var onClose: () -> Unit?

Callback for when the connection is closed for any reason.

Link copied to clipboard
open override var onError: (Throwable) -> Unit?

Callback for when an error occurs.

Link copied to clipboard
open override var onMessage: suspend (JSONRPCMessage) -> Unit?

Callback for when a message (request or response) is received over the connection.

Link copied to clipboard

Functions

Link copied to clipboard
open suspend override fun close()

Closes the connection.

Link copied to clipboard
suspend fun handleMessage(message: String)

Handle a client message, regardless of how it arrived. This can be used to inform the server of messages that arrive via a means different from HTTP POST.

Link copied to clipboard
suspend fun handlePostMessage(call: ApplicationCall)

Handles incoming POST messages.

Link copied to clipboard
open suspend override fun send(message: JSONRPCMessage)

Sends a JSON-RPC message (request or response).

Link copied to clipboard
open suspend override fun start()

Handles the initial SSE connection request.