Skip to content

Commit d87173d

Browse files
author
Daniel Rees
authored
Updated readme for socket name changes
1 parent ffde1ce commit d87173d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff 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 = Socket("http://localhost:4000/socket/websocket", params)
1919

2020
// Listen to events on the Socket
2121
socket.logger = { Log.d("TAG", it) }
@@ -27,9 +27,9 @@ fun connectToChatRoom() {
2727

2828
// Join channels and listen to events
2929
val chatroom = socket.channel("chatroom:general")
30-
chatroom.on("new_message") {
31-
// `it` is a PhxMessage object
32-
val payload = it.payload
30+
chatroom.on("new_message") { message ->
31+
val payload = message.payload
32+
...
3333
}
3434

3535
chatroom.join()
@@ -46,9 +46,9 @@ val client = OkHttpClient.Builder()
4646
.build()
4747

4848
val params = hashMapOf("token" to "abc123")
49-
val socket = PhxSocket("http://localhost:4000/socket/websocket",
50-
multipleParams,
51-
client)
49+
val socket = Socket("http://localhost:4000/socket/websocket",
50+
params,
51+
client)
5252
```
5353

5454

0 commit comments

Comments
 (0)