mrniko / netty-socketio

Socket.IO server implemented on Java. Realtime java framework
Apache License 2.0
6.84k stars 1.66k forks source link

Use with KTOR #542

Open RobertMenke opened 6 years ago

RobertMenke commented 6 years ago

Hey there, thank you for all of your hard work on this library. I just have a quick question. I'm evaluating ktor as a framework and have set up a sample project using netty as a server.

I have a very basic connection setup as follows:

class SecureSocketServer {

    private val config = getConfiguration()
    private val server = SocketIOServer(config)

    fun start() {
        server.start()
    }

    fun <T>addEvent(eventName : String, serializeTo : Class<T>, listener : DataListener<T>) {
        server.addEventListener(eventName, serializeTo, listener)
    }

    private fun getConfiguration() : Configuration {
        val config = Configuration()
        config.hostname = "localhost"
        config.port = 8443
        config.pingTimeout = 60
        config.pingInterval = 60
        config.keyStorePassword = "testing"
        config.keyStore = SecureSocketServer::class.java.getResourceAsStream("/jks/selfsigned.jks")

        return config
    }
}

When starting the server I get what seems to be a success message INFO c.c.socketio.SocketIOServer - SocketIO server started at port: 8443, but my web socket.io-client (1.7.4) and android socket.io client io.socket:socket.io-client:0.8.3 are unable to connect. In both cases, the connections are refused.

I've also set up samples with using ktor's standard socket library and have been able to successfully connect with both the web and android's standard websocket libraries.

Could there be an incompatibility with ktor, or is my configuration incorrect?

ghost commented 1 year ago

Found any way?