SuspendSocketCommunicator

interface SuspendSocketCommunicator : AutoCloseable

An interface to facilitate communication with signald socket. The implementation might close socket connections after making a request, in which case, the readLineSuspend function will not be supported.

This variant has suspending operations for JavaScript (Node.js) support.

Functions

close
Link copied to clipboard
common
abstract fun close()
readLineSuspend
Link copied to clipboard
common
abstract suspend fun readLineSuspend(): String?
Reads a JSON message from the socket, blocking until a message is received or returning null if the socket closes.
submitSuspend
Link copied to clipboard
common
abstract suspend fun submitSuspend(request: String): String
Sends the request to the socket as a single line of JSON (line terminated with \n), and returns the JSON response from signald.