Skip to content

Instantly share code, notes, and snippets.

@aksel
Last active February 12, 2021 11:35
Show Gist options
  • Save aksel/b3e986e2aa14ac78ec3fde87bd960312 to your computer and use it in GitHub Desktop.
Save aksel/b3e986e2aa14ac78ec3fde87bd960312 to your computer and use it in GitHub Desktop.
Kotlin Socket.IO example connection function.
import io.socket.client.IO
import io.socket.client.Socket
fun connect() {
val socket = IO.socket("http://localhost:4000?user=aksel")
socket.connect()
.on(Socket.EVENT_CONNECT, { println("connected") })
.on(Socket.EVENT_DISCONNECT, { println("disconnected") })
}
@stivenson
Copy link

cool, man @aksel , thanks, please to check your gradle file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment