phoenix-channel / ch.kuon.phoenix / Channel

Channel

class Channel

Phoenix channel client

Channels are created using the Socket.channel method.

Types

Event

Channel built in events

enum class Event

Message

Channel messages

abstract class Message

Push

class Push

State

Channel state

enum class State

Properties

params

var params: JSONObject

socket

var socket: Socket

topic

var topic: String

Functions

join

Join the channel.

fun join(timeout: Int = this.timeout): Push

leave

Leave a channel

fun leave(timeout: Int = this.timeout): Push

off

Unregister a callback

fun off(event: String, ref: Ref? = null): Unit

on

Register a callback on arbitrary event

fun on(event: String, callback: (Message) -> Unit): Ref

onClose

Register a close callback

fun onClose(callback: () -> Unit): Ref

onError

Register an error callback

fun onError(callback: (String) -> Unit): Ref

push

Push a message to the channel.

fun push(event: String, payload: JSONObject = JSONObject(), timeout: Int = this.timeout): Push

toString

fun toString(): String

Companion Object Properties

LifeCycleEvents

val LifeCycleEvents: List<String>