Package-level declarations

Types

Link copied to clipboard
data class Binding(val event: String, val ref: Int, val callback: (Message) -> Unit)

Represents a binding to a Channel event

Link copied to clipboard
class Channel(val topic: String, paramsClosure: PayloadClosure, socket: Socket)

Represents a Channel bound to a given topic

Link copied to clipboard
typealias DecodeClosure = (String) -> Message

A closure that will decode a JSON String into a Message

Link copied to clipboard
object Defaults
Link copied to clipboard
interface DispatchQueue

Interface which abstracts away scheduling future tasks, allowing fake instances to be injected and manipulated during tests

Link copied to clipboard

Abstracts away a future task

Link copied to clipboard
typealias EncodeClosure = (Any) -> String

A closure that will encode a Map into a JSON String

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

Closure signature of OnJoin callbacks

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

Closure signature for OnLeave callbacks

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

Closure signature for OnSync callbacks

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

Alias for a JSON mapping

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

A closure that will return an optional Payload

Link copied to clipboard
class Presence(channel: Channel, opts: Presence.Options = Options.defaults)
Link copied to clipboard

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

Link copied to clipboard

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

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

Meta details of a Presence. Just a dictionary of properties

Link copied to clipboard

A mapping of a Presence state to a mapping of Metas

Link copied to clipboard
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.

Link copied to clipboard

A DispatchQueue that uses a ScheduledThreadPoolExecutor to schedule tasks to be executed in the future.

Link copied to clipboard

A DispatchWorkItem that wraps a ScheduledFuture<*> created by a ScheduledDispatchQueue

Link copied to clipboard
class Socket(url: String, val paramsClosure: PayloadClosure, val vsn: String = Defaults.VSN, encode: EncodeClosure = Defaults.encode, decode: DecodeClosure = Defaults.decode, client: OkHttpClient = OkHttpClient.Builder().build())

A Socket which connects to a Phoenix Server. Takes a closure to allow for changing parameters to be sent to the server when connecting.

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. Can be configured to use a custom retry pattern, such as exponential backoff.

Link copied to clipboard
interface Transport

Interface that defines different types of Transport layers. A default {@link WebSocketTransport} is provided which uses an OkHttp WebSocket to transport data between your Phoenix server.

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

Link copied to clipboard
const val WS_CLOSE_ABNORMAL: Int = 1006

RFC 6455: indicates that the connection was closed abnormally

Link copied to clipboard
const val WS_CLOSE_NORMAL: Int = 1000

RFC 6455: indicates a normal closure