Push

class Push(channel: Channel, event: String, payloadClosure: PayloadClosure, timeout: Long)

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

Constructors

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

Functions

receive
Link copied to clipboard
fun receive(status: String, callback: (Message) -> Unit): Push
Receive a specific event when sending an Outbound messageExample: channel .send("event", myPayload) .
resend
Link copied to clipboard
fun resend(timeout: Long = Defaults.TIMEOUT)
Resets and sends the Push
send
Link copied to clipboard
fun send()
Sends the Push.

Properties

channel
Link copied to clipboard
val channel: Channel
The channel the Push is being sent through
event
Link copied to clipboard
val event: String
The event the Push is targeting
payload
Link copied to clipboard
var payload: Payload
payloadClosure
Link copied to clipboard
var payloadClosure: PayloadClosure
Closure that allows changing parameters sent during push
receivedMessage
Link copied to clipboard
var receivedMessage: Message? = null
The server's response to the Push
receiveHooks
Link copied to clipboard
var receiveHooks: MutableMap<String, List<(message: Message) -> Unit>>
Hooks into a Push.
ref
Link copied to clipboard
var ref: String? = null
The reference ID of the Push
refEvent
Link copied to clipboard
var refEvent: String? = null
The event that is associated with the reference ID of the Push
sent
Link copied to clipboard
var sent: Boolean = false
True if the Push has been sent
timeout
Link copied to clipboard
var timeout: Long
Duration before the message is considered timed out and failed to send
timeoutTask
Link copied to clipboard
var timeoutTask: DispatchWorkItem? = null
The task to be triggered if the Push times out