diff --git a/docs/alltypes/index.html b/docs/alltypes/index.html index 2bfc86c..518f6b8 100644 --- a/docs/alltypes/index.html +++ b/docs/alltypes/index.html @@ -1,7 +1,7 @@
-Phoenix channel client
Exponential backoff timer
Listen for presence changes
Socket main constructor.
enum class Event
+Channel built in events
+ Channel messages Message() |
@@ -29,6 +33,7 @@
+ Response data from the server abstract val response: JSONObject |
+ Status of the response as sent by the server. abstract val status: String |
+ Returns the error reason. open fun getError(): String |
+ Returns the error state of the message open fun isError(): Boolean |
-build- |
-
-fun build(status: String, response: JSONObject): Message - fun build(payload: JSONObject): Message |
-
-error- |
-
-fun error(error: String): Message |
-
-leave- |
-
-fun leave(): Message |
-
-none- |
-
-fun none(): Message |
-
open fun isError(): Boolean
+Returns the error state of the message
diff --git a/docs/ch.kuon.phoenix/-channel/-message/leave.html b/docs/ch.kuon.phoenix/-channel/-message/leave.html deleted file mode 100644 index 8cf75a3..0000000 --- a/docs/ch.kuon.phoenix/-channel/-message/leave.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -fun leave(): Message
-
-
diff --git a/docs/ch.kuon.phoenix/-channel/-message/none.html b/docs/ch.kuon.phoenix/-channel/-message/none.html
deleted file mode 100644
index 7757ae4..0000000
--- a/docs/ch.kuon.phoenix/-channel/-message/none.html
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-fun none(): Message
-
-
diff --git a/docs/ch.kuon.phoenix/-channel/-message/response.html b/docs/ch.kuon.phoenix/-channel/-message/response.html
index 21968c0..d2def53 100644
--- a/docs/ch.kuon.phoenix/-channel/-message/response.html
+++ b/docs/ch.kuon.phoenix/-channel/-message/response.html
@@ -1,14 +1,17 @@
-abstract val response: JSONObject
+Response data from the server
+It can be an empty object if the response was empty, but never
+null
.
abstract val status: String
+Status of the response as sent by the server.
diff --git a/docs/ch.kuon.phoenix/-channel/-push/-init-.html b/docs/ch.kuon.phoenix/-channel/-push/-init-.html index d9bdf71..a2213bb 100644 --- a/docs/ch.kuon.phoenix/-channel/-push/-init-.html +++ b/docs/ch.kuon.phoenix/-channel/-push/-init-.html @@ -1,11 +1,11 @@ -class Push
@@ -29,6 +29,8 @@ Register a callback when a message with the following +status is returned.
fun receive(status: String, callback: (JSONObject) -> Unit): Push
fun receive(status: String, callback: (JSONObject) -> Unit): Push
+Register a callback when a message with the following +status is returned.
+Note: the callback might be called from another thread.
+
+status
- The status to register the callback for
+callback
- A callback called with the response
Return
+Self for method chaining
enum class State
+Channel state
+ Channel built in events enum class Event |
+ Channel messages abstract class Message |
+ Channel state enum class State |
-<init>- |
-
-Channel(topic: String, params: JSONObject, socket: Socket) |
-
+ Join the channel. fun join(timeout: Int = this.timeout): Push |
|||||||||||||||||||||||||||||
+ Leave a channel fun leave(timeout: Int = this.timeout): Push |
|||||||||||||||||||||||||||||
+ Unregister a callback fun off(event: String, ref: Ref? = null): Unit |
|||||||||||||||||||||||||||||
+ Register a callback on arbitrary event fun on(event: String, callback: (Message) -> Unit): Ref |
|||||||||||||||||||||||||||||
+ Register a close callback fun onClose(callback: () -> Unit): Ref |
|||||||||||||||||||||||||||||
+ Register an error callback fun onError(callback: (String) -> Unit): Ref |
|||||||||||||||||||||||||||||
+ Push a message to the channel. fun push(event: String, payload: JSONObject = JSONObject(), timeout: Int = this.timeout): Push |
|||||||||||||||||||||||||||||
- A function that is called when the timer is scheduled.
- It is called with the current try and must return a
- time in miliseconds. It is used to implement exponential
- timers. First value of A function that is called when the timer is scheduled. var timerCalc: (Int) -> Int |
|
+ Reset the timeout and cancel the timer if it is scheduled. fun reset(): Unit |
|
+ Schedule the timer to run once fun scheduleTimeout(): Unit |
+<init>+ |
+
+LibraryTest() |
+
+testBroadcast+ |
+
+fun testBroadcast(): Unit |
+
+testConnect+ |
+
+fun testConnect(): Unit |
+
+testEcho+ |
+
+fun testEcho(): Unit |
+
+testJoinError+ |
+
+fun testJoinError(): Unit |
+
+testPresence+ |
+
+fun testPresence(): Unit |
+
+testTimer+ |
+
+fun testTimer(): Unit |
+
+testURL+ |
+
+fun testURL(): Unit |
+
fun testBroadcast(): Unit
+
+
diff --git a/docs/ch.kuon.phoenix/-library-test/test-connect.html b/docs/ch.kuon.phoenix/-library-test/test-connect.html
new file mode 100644
index 0000000..205885d
--- /dev/null
+++ b/docs/ch.kuon.phoenix/-library-test/test-connect.html
@@ -0,0 +1,14 @@
+
+
+
+fun testConnect(): Unit
+
+
diff --git a/docs/ch.kuon.phoenix/-library-test/test-echo.html b/docs/ch.kuon.phoenix/-library-test/test-echo.html
new file mode 100644
index 0000000..694995b
--- /dev/null
+++ b/docs/ch.kuon.phoenix/-library-test/test-echo.html
@@ -0,0 +1,14 @@
+
+
+
+fun testEcho(): Unit
+
+
diff --git a/docs/ch.kuon.phoenix/-library-test/test-join-error.html b/docs/ch.kuon.phoenix/-library-test/test-join-error.html
new file mode 100644
index 0000000..29ba032
--- /dev/null
+++ b/docs/ch.kuon.phoenix/-library-test/test-join-error.html
@@ -0,0 +1,14 @@
+
+
+
+fun testJoinError(): Unit
+
+
diff --git a/docs/ch.kuon.phoenix/-library-test/test-presence.html b/docs/ch.kuon.phoenix/-library-test/test-presence.html
new file mode 100644
index 0000000..38c454c
--- /dev/null
+++ b/docs/ch.kuon.phoenix/-library-test/test-presence.html
@@ -0,0 +1,14 @@
+
+
+
+fun testPresence(): Unit
+
+
diff --git a/docs/ch.kuon.phoenix/-library-test/test-timer.html b/docs/ch.kuon.phoenix/-library-test/test-timer.html
new file mode 100644
index 0000000..6a694f4
--- /dev/null
+++ b/docs/ch.kuon.phoenix/-library-test/test-timer.html
@@ -0,0 +1,14 @@
+
+
+
+fun testTimer(): Unit
+
+
diff --git a/docs/ch.kuon.phoenix/-library-test/test-u-r-l.html b/docs/ch.kuon.phoenix/-library-test/test-u-r-l.html
new file mode 100644
index 0000000..9b727c9
--- /dev/null
+++ b/docs/ch.kuon.phoenix/-library-test/test-u-r-l.html
@@ -0,0 +1,14 @@
+
+
+
+fun testURL(): Unit
+
+
diff --git a/docs/ch.kuon.phoenix/-presence/-diff/-init-.html b/docs/ch.kuon.phoenix/-presence/-diff/-init-.html
deleted file mode 100644
index e58d75d..0000000
--- a/docs/ch.kuon.phoenix/-presence/-diff/-init-.html
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-Diff(joins: HashMap<String, Entry>, leaves: HashMap<String, Entry>)
-
-
diff --git a/docs/ch.kuon.phoenix/-presence/-diff/index.html b/docs/ch.kuon.phoenix/-presence/-diff/index.html
deleted file mode 100644
index 6322f1c..0000000
--- a/docs/ch.kuon.phoenix/-presence/-diff/index.html
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-class Diff
-
-<init>- |
-
-Diff(joins: HashMap<String, Entry>, leaves: HashMap<String, Entry>) |
-
-joins- |
-
-val joins: HashMap<String, Entry> |
-
-leaves- |
-
-val leaves: HashMap<String, Entry> |
-
val joins: HashMap<String, Entry>
-
-
diff --git a/docs/ch.kuon.phoenix/-presence/-diff/leaves.html b/docs/ch.kuon.phoenix/-presence/-diff/leaves.html
deleted file mode 100644
index 7818171..0000000
--- a/docs/ch.kuon.phoenix/-presence/-diff/leaves.html
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-val leaves: HashMap<String, Entry>
-
-
diff --git a/docs/ch.kuon.phoenix/-presence/-entry/-init-.html b/docs/ch.kuon.phoenix/-presence/-entry/-init-.html
index 88c5167..8a391e6 100644
--- a/docs/ch.kuon.phoenix/-presence/-entry/-init-.html
+++ b/docs/ch.kuon.phoenix/-presence/-entry/-init-.html
@@ -1,14 +1,18 @@
-Entry(str: String)
+Entry(rawData: String)
+A presence entry
+While presence are JSONObject subclasses, they should be considered +immutable.
+Presence entries are returned by Presence.list and other callbacks.
diff --git a/docs/ch.kuon.phoenix/-presence/-entry/get-metas.html b/docs/ch.kuon.phoenix/-presence/-entry/get-metas.html new file mode 100644 index 0000000..74e0c3a --- /dev/null +++ b/docs/ch.kuon.phoenix/-presence/-entry/get-metas.html @@ -0,0 +1,17 @@ + + + +fun getMetas(): JSONArray
+The presence meta data
+This is an arbitrary array and the format depends on your +implementation.
+ + diff --git a/docs/ch.kuon.phoenix/-presence/-entry/index.html b/docs/ch.kuon.phoenix/-presence/-entry/index.html index f9f1840..78415c0 100644 --- a/docs/ch.kuon.phoenix/-presence/-entry/index.html +++ b/docs/ch.kuon.phoenix/-presence/-entry/index.html @@ -1,14 +1,18 @@ -class Entry : JSONObject
+A presence entry
+While presence are JSONObject subclasses, they should be considered +immutable.
+Presence entries are returned by Presence.list and other callbacks.
-Entry(str: String) |
+
val metas: JSONArray!
val str: String
The JSON string that sent by the server
+val rawData: String
fun prependMetas(newMetas: List<JSONObject>): Unit
fun setMetas(metas: JSONArray): Unit
fun setMetas(metas: List<JSONObject>): Unit
The presence meta data
+fun getMetas(): JSONArray
val metas: JSONArray!
-
-
diff --git a/docs/ch.kuon.phoenix/-presence/-entry/prepend-metas.html b/docs/ch.kuon.phoenix/-presence/-entry/prepend-metas.html
deleted file mode 100644
index e41a54d..0000000
--- a/docs/ch.kuon.phoenix/-presence/-entry/prepend-metas.html
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-fun prependMetas(newMetas: List<JSONObject>): Unit
-
-
diff --git a/docs/ch.kuon.phoenix/-presence/-entry/raw-data.html b/docs/ch.kuon.phoenix/-presence/-entry/raw-data.html
new file mode 100644
index 0000000..bdbfc90
--- /dev/null
+++ b/docs/ch.kuon.phoenix/-presence/-entry/raw-data.html
@@ -0,0 +1,18 @@
+
+
+
+val rawData: String
+The JSON string that sent by the server
+
+rawData
- The JSON string that sent by the server
fun setMetas(metas: JSONArray): Unit
fun setMetas(metas: List<JSONObject>): Unit
-
-
diff --git a/docs/ch.kuon.phoenix/-presence/-entry/str.html b/docs/ch.kuon.phoenix/-presence/-entry/str.html
deleted file mode 100644
index b5edff2..0000000
--- a/docs/ch.kuon.phoenix/-presence/-entry/str.html
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-val str: String
-
-
diff --git a/docs/ch.kuon.phoenix/-presence/-init-.html b/docs/ch.kuon.phoenix/-presence/-init-.html
index 40a7b3e..a20ff6d 100644
--- a/docs/ch.kuon.phoenix/-presence/-init-.html
+++ b/docs/ch.kuon.phoenix/-presence/-init-.html
@@ -1,14 +1,15 @@
-Presence(channel: Channel, opts: Options = Options())
+Listen for presence changes
diff --git a/docs/ch.kuon.phoenix/-presence/-options/-event-names/-init-.html b/docs/ch.kuon.phoenix/-presence/-options/-event-names/-init-.html index 70f321a..d647121 100644 --- a/docs/ch.kuon.phoenix/-presence/-options/-event-names/-init-.html +++ b/docs/ch.kuon.phoenix/-presence/-options/-event-names/-init-.html @@ -1,11 +1,11 @@ -class EventNames
diff --git a/docs/ch.kuon.phoenix/-presence/-options/-event-names/state.html b/docs/ch.kuon.phoenix/-presence/-options/-event-names/state.html
index 77a1a45..84d2632 100644
--- a/docs/ch.kuon.phoenix/-presence/-options/-event-names/state.html
+++ b/docs/ch.kuon.phoenix/-presence/-options/-event-names/state.html
@@ -1,11 +1,11 @@
-Options(eventNames: EventNames = EventNames("presence_state", "presence_diff"))
+Presence options
+Default options should be used except for special requirements. +They line up with phoenix default options.
diff --git a/docs/ch.kuon.phoenix/-presence/-options/event-names.html b/docs/ch.kuon.phoenix/-presence/-options/event-names.html index 1e97056..7895b58 100644 --- a/docs/ch.kuon.phoenix/-presence/-options/event-names.html +++ b/docs/ch.kuon.phoenix/-presence/-options/event-names.html @@ -1,11 +1,11 @@ -class Options
+Presence options
+Default options should be used except for special requirements. +They line up with phoenix default options.
+ Presence options Options(eventNames: EventNames = EventNames("presence_state", "presence_diff")) |
diff --git a/docs/ch.kuon.phoenix/-presence/channel.html b/docs/ch.kuon.phoenix/-presence/channel.html
index f5208c4..b0bebca 100644
--- a/docs/ch.kuon.phoenix/-presence/channel.html
+++ b/docs/ch.kuon.phoenix/-presence/channel.html
@@ -1,14 +1,18 @@
-
-Diff- |
-
-class Diff |
-
Entry |
+ A presence entry class Entry : JSONObject |
+ Presence options class Options |
+ Listen for presence changes Presence(channel: Channel, opts: Options = Options()) |
@@ -55,6 +52,7 @@
+ A channel val channel: Channel |
+ Options val opts: Options |
+ Is there any pendinng sync state fun inPendingSyncState(): Boolean |
+ Returns the list of presence fun list(by: (String, Entry) -> Entry = { _, p -> p }): List<Entry> |
|
-clone- |
-
-fun clone(obj: HashMap<String, Entry>): HashMap<String, Entry> - fun clone(entry: Entry): Entry |
-
-list- |
-
-fun list(presences: HashMap<String, Entry>, chooser: (String, Entry) -> Entry = { _, p -> p }): List<Entry> |
-
-map- |
-
-fun map(entries: HashMap<String, Entry>, func: (String, Entry) -> Entry): List<Entry> |
-
-syncDiff- |
-
-fun syncDiff(currentState: HashMap<String, Entry>, diff: Diff, onJoin: (key: String, currentPresence: Entry?, newPresence: Entry) -> Unit, onLeave: (key: String, currentPresence: Entry?, leftPresence: Entry) -> Unit): HashMap<String, Entry> |
-
-syncState- |
-
-fun syncState(currentState: HashMap<String, Entry>, newState: HashMap<String, Entry>, onJoin: (key: String, currentPresence: Entry?, newPresence: Entry) -> Unit, onLeave: (key: String, currentPresence: Entry?, leftPresence: Entry) -> Unit): HashMap<String, Entry> |
-
fun list(by: (String, Entry) -> Entry = { _, p -> p }): List<Entry>
fun list(presences: HashMap<String, Entry>, chooser: (String, Entry) -> Entry = { _, p -> p }): List<Entry>
+fun list(by: (String, Entry) -> Entry = { _, p -> p }): List<Entry>
+Returns the list of presence
+This method will return every presence returned by the server
diff --git a/docs/ch.kuon.phoenix/-presence/map.html b/docs/ch.kuon.phoenix/-presence/map.html deleted file mode 100644 index 8512326..0000000 --- a/docs/ch.kuon.phoenix/-presence/map.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -fun map(entries: HashMap<String, Entry>, func: (String, Entry) -> Entry): List<Entry>
-
-
diff --git a/docs/ch.kuon.phoenix/-presence/on-join.html b/docs/ch.kuon.phoenix/-presence/on-join.html
index d8e1e15..8163828 100644
--- a/docs/ch.kuon.phoenix/-presence/on-join.html
+++ b/docs/ch.kuon.phoenix/-presence/on-join.html
@@ -1,16 +1,17 @@
-fun onJoin(callback: (key: String, currentPresence: Entry?, newPresence: Entry) -> Unit): Unit
Set the callback for join event
+Note: the callback might be called on another thread
callback
- The function to be called on join
fun onLeave(callback: (key: String, currentPresence: Entry?, leftPresence: Entry) -> Unit): Unit
Set the callback for leave event
+Note: the callback might be called on another thread
callback
- The function to be called on leave
fun onSync(callback: () -> Unit): Unit
Set the callback for sync event
+Note: the callback might be called on another thread
callback
- The function to be called on sync
val opts: Options
+Options
+fun syncDiff(currentState: HashMap<String, Entry>, diff: Diff, onJoin: (key: String, currentPresence: Entry?, newPresence: Entry) -> Unit, onLeave: (key: String, currentPresence: Entry?, leftPresence: Entry) -> Unit): HashMap<String, Entry>
-
-
diff --git a/docs/ch.kuon.phoenix/-presence/sync-state.html b/docs/ch.kuon.phoenix/-presence/sync-state.html
deleted file mode 100644
index ecf6bfb..0000000
--- a/docs/ch.kuon.phoenix/-presence/sync-state.html
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-fun syncState(currentState: HashMap<String, Entry>, newState: HashMap<String, Entry>, onJoin: (key: String, currentPresence: Entry?, newPresence: Entry) -> Unit, onLeave: (key: String, currentPresence: Entry?, leftPresence: Entry) -> Unit): HashMap<String, Entry>
-
-
diff --git a/docs/ch.kuon.phoenix/-socket/-init-.html b/docs/ch.kuon.phoenix/-socket/-init-.html
index 0415c12..a639950 100644
--- a/docs/ch.kuon.phoenix/-socket/-init-.html
+++ b/docs/ch.kuon.phoenix/-socket/-init-.html
@@ -1,14 +1,21 @@
-Socket(url: String, opts: Options = Socket.Options())
+Socket main constructor.
+This class is a thin layer above websockets. This layer provides +compatibility with Phoenix Sockets. It handle heartbeat, serialization and +provides a simple event based API.
+When using Phoenix, you will usually not push messages directly to sockets +but use Channels instead.
+The url can use either the ws://
or wss://
scheme.
Message(joinRef: Int? = null, ref: Int? = null, topic: String, event: String, payload: JSONObject = JSONObject())
+A raw socket message.
+This object is usually not created directly and Channel.Message +is used instead.
diff --git a/docs/ch.kuon.phoenix/-socket/-message/event.html b/docs/ch.kuon.phoenix/-socket/-message/event.html index 8b22d58..ac6856f 100644 --- a/docs/ch.kuon.phoenix/-socket/-message/event.html +++ b/docs/ch.kuon.phoenix/-socket/-message/event.html @@ -1,14 +1,18 @@ -var event: String
+The event name
+class Message
+A raw socket message.
+This object is usually not created directly and Channel.Message +is used instead.
+ A raw socket message. Message(joinRef: Int? = null, ref: Int? = null, topic: String, event: String, payload: JSONObject = JSONObject()) |
@@ -29,6 +33,7 @@
+ The event name var event: String |
+ A join_ref var joinRef: Int? |
|
+ A payload object var payload: JSONObject |
|
+ The ref var ref: Int? |
|
+ The topic var topic: String |
+ Socket options. Options() |
@@ -29,6 +35,7 @@
+ Heartbeat interval in miliseconds var heartbeatIntervalMs: Long |
+ Logger function (must be thread safe) var logger: ((String, String) -> Unit)? |
|
+ A list of key/value sent with the conection. var params: HashMap<String, Any>? |
|
+ Reconnect interval functions (must be thread safe) var reconnectAfterMs: (Int) -> Int |
|
+ Rejoin interval functions (must be thread safe) var rejoinAfterMs: (Int) -> Int |
|
+ Timeout in miliseconds var timeout: Int |
+ A raw socket message. class Message |
|
+ Socket options. class Options |
|
+ Enum representing socket state enum class State |
+ Socket main constructor. Socket(url: String, opts: Options = Socket.Options()) |
@@ -55,6 +66,8 @@
+ An var opts: Options |
+ The full web socket URL var url: String |
+ Prefered constructor for channels. fun channel(topic: String, params: JSONObject = JSONObject()): Channel |
+ Connect the socket to the server fun connect(): Unit |
|
+ Returns the current socket state fun connectionState(): State |
|
+ Disconnect the socket. fun disconnect(callback: (() -> Unit)? = null, code: Int? = null, reason: String? = null): Unit |
|
+ Returns the connected state (if state is OPEN) fun isConnected(): Boolean |
|
- Log a message.
-Override Log a message. fun log(tag: String, msg: String, data: Any? = null): Unit |
|
-fun off(refs: List<Int>): Unit |
+|
onClose |
+ Register an close callback. +Multiple callbacks can be registerd. fun onClose(callback: CloseCallback): Ref |
+ Register an error callback. +Multiple callbacks can be registerd. fun onError(callback: ErrorCallback): Ref |
|
+ Register an on message callback. +Multiple callbacks can be registerd. fun onMessage(callback: MessageCallback): Ref |
|
+ Register an open callback. +Multiple callbacks can be registerd. fun onOpen(callback: OpenCallback): Ref |
|
+ Push a message to the socket fun push(msg: Message): Unit |
|
+ Phoenix channel client class Channel |
|
+LibraryTest+ |
+
+class LibraryTest |
+
Presence |
+ Listen for presence changes class Presence |
+ Socket main constructor. class Socket : WebSocketAdapter |
+url+ |
+
+val url: String |
+
val url: String
+
+
diff --git a/docs/index-outline.html b/docs/index-outline.html
index e457201..82a8513 100644
--- a/docs/index-outline.html
+++ b/docs/index-outline.html
@@ -5,7 +5,7 @@
-java-phoenix-channel