简体   繁体   中英

netty-socketio integration with Tomcat8

I'm thinking of using socket.io for a real time web app written in Java. From what I see socket.io server is mainly developed for Node.js and there are ports for it in Java. Seems netty-socketio is a stable solution.

I can't figure out though if I can embed it in a WAR file within my application running on Tomcat8 and have no issue running it like that.

Has anyone integrated this within a WAR file in Tomcat8?

It's as easy as pie, just create com.corundumstudio.socketio.SocketIOServer . Example:

In your tomcat Servlet.init method type follow:

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

SocketIOServer server = new SocketIOServer(config);
server.start();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM