File tree Expand file tree Collapse file tree
src/main/kotlin/org/phoenixframework Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ fun connectToChatRoom() {
1515
1616 // Create the Socket
1717 val params = hashMapOf(" token" to " abc123" )
18- val socket = PhxSocket (" http://localhost:4000/socket/websocket" , multipleParams
18+ val socket = PhxSocket (" http://localhost:4000/socket/websocket" , multipleParams)
1919
2020 // Listen to events on the Socket
2121 socket.logger = { Log .d(" TAG" , it) }
@@ -38,6 +38,19 @@ fun connectToChatRoom() {
3838}
3939```
4040
41+ You can also inject your own OkHttp Client into the Socket to provide your own configuration
42+ ``` kotlin
43+ // Create the Socket with a pre-configured OkHttp Client
44+ val client = OkHttpClient .Builder ()
45+ .connectTimeout(1000 , TimeUnit .MILLISECONDS )
46+ .build()
47+
48+ val params = hashMapOf(" token" to " abc123" )
49+ val socket = PhxSocket (" http://localhost:4000/socket/websocket" ,
50+ multipleParams,
51+ client)
52+ ```
53+
4154
4255### Installation
4356
Original file line number Diff line number Diff line change 11package org.phoenixframework
22
3+ import com.google.gson.annotations.SerializedName
4+
35class PhxMessage (
46 /* * The unique string ref. Empty if not present */
7+ @SerializedName(" ref" )
58 val ref : String = " " ,
9+
610 /* * Property "topic" is never used */
11+ @SerializedName(" topic" )
712 val topic : String = " " ,
13+
814 /* * Property "topic" is never used */
15+ @SerializedName(" event" )
916 val event : String = " " ,
17+
1018 /* * Property "topic" is never used */
19+ @SerializedName(" payload" )
1120 val payload : Payload = HashMap (),
21+
1222 /* * The ref sent during a join event. Empty if not present. */
23+ @SerializedName(" join_ref" )
1324 val joinRef : String? = null ) {
1425
1526
You can’t perform that action at this time.
0 commit comments