Push

class Push(val channel: Channel, val event: String, var payloadClosure: PayloadClosure, var timeout: Long = Defaults.TIMEOUT)

A Push represents an attempt to send a payload through a Channel for a specific event.

Constructors

Link copied to clipboard
constructor(channel: Channel, event: String, payload: Payload = mapOf(), timeout: Long = Defaults.TIMEOUT)
constructor(channel: Channel, event: String, payloadClosure: PayloadClosure, timeout: Long = Defaults.TIMEOUT)

Properties

Link copied to clipboard

The channel the Push is being sent through

Link copied to clipboard

The event the Push is targeting

Link copied to clipboard
Link copied to clipboard

Closure that allows changing parameters sent during push

Link copied to clipboard

The server's response to the Push

Link copied to clipboard

Hooks into a Push. Where .receive("ok", callback(Payload)) are stored

Link copied to clipboard
var ref: String?

The reference ID of the Push

Link copied to clipboard

The event that is associated with the reference ID of the Push

Link copied to clipboard

True if the Push has been sent

Link copied to clipboard

Duration before the message is considered timed out and failed to send

Link copied to clipboard

The task to be triggered if the Push times out

Functions

Link copied to clipboard
fun receive(callback: (status: String, message: Message) -> Unit): Push

Receives any event that was a response to an outbound message.

fun receive(status: String, callback: (Message) -> Unit): Push

Receive a specific event when sending an Outbound message

Link copied to clipboard
fun resend(timeout: Long = Defaults.TIMEOUT)

Resets and sends the Push

Link copied to clipboard
fun send()

Sends the Push. If it has already timed out then the call will be ignored. use resend(timeout:) in this case.