netty-socketio icon indicating copy to clipboard operation
netty-socketio copied to clipboard

SocketIOServer with Spring Boot REST all on port 8080?

Open datumgeek opened this issue 6 years ago • 4 comments

I'm trying to configure a Sprint Boot REST app that uses port 8080 to also use SocketIOServer on port 8080.

if i use another port for SocketIOServer, it works fine.

if i use port 8080, i get a port in use error unless i set the following:

    @Bean
    public SocketIOServer socketIOServer() {
        com.corundumstudio.socketio.Configuration config =
                new com.corundumstudio.socketio.Configuration();
        config.setHostname(nwtNasaWebsocketServer);
        config.setPort(Integer.parseInt(nwtNasaWebsocketPortString));
        SocketConfig sockConfig = new SocketConfig();
        sockConfig.setReuseAddress(true);
        config.setSocketConfig(sockConfig);
        return new SocketIOServer(config);
    }

but then when i try to connect from the socket io client, i get a 404:

image

and on the server

Looking up Handler for path socket.io Did not find Handler for path /socket.io/

image

datumgeek avatar Apr 21 '18 23:04 datumgeek

when spring boot application running ,you need:

@autowaried private SocketIOServer socketIoServer;

SocketIOServer.start();

lilaizhencn avatar Apr 22 '18 14:04 lilaizhencn

@lilaizhencn 这个方法行不通。

hailiang-wang avatar Sep 29 '18 14:09 hailiang-wang

@lilaizhencn 这个方法行不通。

那种需要单独给socketIoServer配置一个端口。

lilaizhencn avatar Sep 29 '18 14:09 lilaizhencn

Hi @datumgeek did you get solution for running tomcat and Netty-socketio on same port. I am having the same 404 issue. Thanks!

sansingh avatar Aug 18 '20 15:08 sansingh