mrniko / netty-socketio

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

How to use netty-socketio without create a server? #673

Open sprabhakaran opened 5 years ago

sprabhakaran commented 5 years ago

From the netty-socketio docs I saw the below example for connecting the websocket,

Configuration config = new Configuration();
config.setHostname("localhost");
config.setPort(8444);

SocketIOServer server = new SocketIOServer(config);
server.addEventListener("ackevnt", Class1, DataListener1);
server.addEventListener("getdet", Class2, DataListener2);
server.start();

My requirement is I don't want to start the separate socket server. I need to integrate the netty-socket io in tomcat. I went through all the examples(stackoverflow and githup issues). Everyone suggested the above example only.

I am going to implement The endpoint way of the implementation, WebSocket is a protocol sent over TCP after an initial HTTP handshake. This request has been upgraded and the response contains the critical status code of 101 ( ref ).

Can this framework achieve this?

panteparak commented 4 years ago

Tomcat is a servlet thus not supporting socket.io running on the same server. You will need to create a new server as above.

Sidenote: My integration of netty-socketio with spring-boot (kotlin). Code