Open prodrive11 opened 2 years ago
Server:
"socket.io": "4.5.2", "socket.io-client": "4.5.2",
JS/Postman client connects correctly to server. Kotlin client does nothing. No callbacks are executed, socket.connected stays false.
socket.connected
false
jvm: openjdk-18.0.1.1 paltform/os: ubuntu 21.10 (it's not Android client)
import io.socket.client.IO import io.socket.client.Socket import java.net.URI class ServiceEndpoint() { private var socket: Socket private var uri: URI = URI.create("ws://localhost:3333/") init { var options = IO.Options.builder().build() socket = IO.socket(uri, options) socket.on(Socket.EVENT_CONNECT) { println("Socket connected!") } socket.on(Socket.EVENT_CONNECT_ERROR) {args -> println("connection failed: $args")} socket.io().on(Manager.EVENT_ERROR) { args -> println("error: $args")} } fun run(){ socket.connect() socket.emit("status", "hello") } }
@prodrive11 try adding socket.open() after socket = IO.socket(uri, options)
socket.open()
socket = IO.socket(uri, options)
Server:
JS/Postman client connects correctly to server. Kotlin client does nothing. No callbacks are executed,
socket.connected
staysfalse
.jvm: openjdk-18.0.1.1
paltform/os: ubuntu 21.10 (it's not Android client)