Перейти к содержанию

Spatium SDK > receive


suspend fun receive(driver: TransportDriver, filter: TransportFilter, assert: TransportFilter?, timeout: UInt?): TransportPayload

Receive a specific message

This method awaits until a matching message is received (determined by filter) and resolves with message data. If an assert filter is specified, the message is also checked against it. Such behaviour comes handy for sudden unsubscribing, receiving messages out of order and other erroneous situations.


received message payload (TransportPayload) (both meta and data)



driver TransportDriver implementation
filter incoming message filter
assert (optional) secondary incoming message filter, asserting out-of-order messages
timeout (optional) maximum await delay (in milliseconds), after which the reciever automatically unsubscribes