Package org.phoenixframework

Types

Binding
Link copied to clipboard
data class Binding(event: String, ref: Int, callback: (Message) -> Unit)
Represents a binding to a Channel event
Channel
Link copied to clipboard
class Channel(topic: String, params: Payload, socket: Socket)
Represents a Channel bound to a given topic
DecodeClosure
Link copied to clipboard
typealias DecodeClosure = (String) -> Message

A closure that will decode a JSON String into a Message

Defaults
Link copied to clipboard
object Defaults
DispatchQueue
Link copied to clipboard
interface DispatchQueue
Interface which abstracts away scheduling future tasks, allowing fake instances to be injected and manipulated during tests
DispatchWorkItem
Link copied to clipboard
interface DispatchWorkItem
Abstracts away a future task
EncodeClosure
Link copied to clipboard
typealias EncodeClosure = (Any) -> String

A closure that will encode a Map<String, Any> into a JSON String

Message
Link copied to clipboard
data class Message(joinRef: String?, ref: String, topic: String, event: String, rawPayload: Payload)
OnJoin
Link copied to clipboard
typealias OnJoin = (key: String, current: PresenceMap?, new: PresenceMap) -> Unit

Closure signature of OnJoin callbacks

OnLeave
Link copied to clipboard
typealias OnLeave = (key: String, current: PresenceMap, left: PresenceMap) -> Unit

Closure signature for OnLeave callbacks

OnSync
Link copied to clipboard
typealias OnSync = () -> Unit

Closure signature for OnSync callbacks

Payload
Link copied to clipboard
typealias Payload = Map<String, Any?>

Alias for a JSON mapping

PayloadClosure
Link copied to clipboard
typealias PayloadClosure = () -> Payload?

A closure that will return an optional Payload

Presence
Link copied to clipboard
class Presence(channel: Channel, opts: Presence.Options)
PresenceDiff
Link copied to clipboard
typealias PresenceDiff = MutableMap<String, PresenceState>

Diff has keys "joins" and "leaves", pointing to a Presence.State each containing the users that joined and left.

PresenceMap
Link copied to clipboard
typealias PresenceMap = MutableMap<String, List<PresenceMeta>>

A mapping of a String to an array of Metas. e.g. {"metas": {id: 1}}

PresenceMeta
Link copied to clipboard
typealias PresenceMeta = Map<String, Any>

Meta details of a Presence. Just a dictionary of properties

PresenceState
Link copied to clipboard
typealias PresenceState = MutableMap<String, PresenceMap>

A mapping of a Presence state to a mapping of Metas

Push
Link copied to clipboard
class Push(channel: Channel, event: String, payload: Payload, timeout: Long)
A Push represents an attempt to send a payload through a Channel for a specific event.
ScheduledDispatchQueue
Link copied to clipboard
class ScheduledDispatchQueue(poolSize: Int) : DispatchQueue
A DispatchQueue that uses a ScheduledThreadPoolExecutor to schedule tasks to be executed in the future.
ScheduledDispatchWorkItem
Link copied to clipboard
class ScheduledDispatchWorkItem(scheduledFuture: ScheduledFuture<*>) : DispatchWorkItem
A DispatchWorkItem that wraps a ScheduledFuture<*> created by a ScheduledDispatchQueue
Socket
Link copied to clipboard
class Socket(url: String, paramsClosure: PayloadClosure, vsn: String, encode: EncodeClosure, decode: DecodeClosure, client: OkHttpClient)
A Socket which connects to a Phoenix Server.
TimeoutTimer
Link copied to clipboard
class TimeoutTimer(dispatchQueue: DispatchQueue, callback: () -> Unit, timerCalculation: (tries: Int) -> Long)
A Timer class that schedules a callback to be called in the future.
Transport
Link copied to clipboard
interface Transport
Interface that defines different types of Transport layers.
WebSocketTransport
Link copied to clipboard
class WebSocketTransport(url: URL, okHttpClient: OkHttpClient) : WebSocketListener, Transport
A WebSocket implementation of a Transport that uses a WebSocket to facilitate sending and receiving data.

Properties

WS_CLOSE_ABNORMAL
Link copied to clipboard
const val WS_CLOSE_ABNORMAL: Int = 1006
RFC 6455: indicates that the connection was closed abnormally
WS_CLOSE_NORMAL
Link copied to clipboard
const val WS_CLOSE_NORMAL: Int = 1000
RFC 6455: indicates a normal closure