Socket.io on AWS API Gateway disconnected immediately after the successful connection

229 Views Asked by At

I have implemented socket.io using netty-socket.io in Java and deployed it to AWS API Gateway.

When I try to establish a connection using the gateway WSS URL it getting disconnected immediately after connection.

NettySocketConfig.java

@Bean
public SocketIOServer socketIOServer() {
        Configuration config = new Configuration();
        config.setPort(5291);
        config.setContext("/socket");
        SocketIOServer socketIOServer = new SocketIOServer(config);
        return socketIOServer;
}
    

API Gateway configuration: API Gateway configuration

And $Disconnect is configured with endpoint URL: http://{server.ip.adderss}:5291/socket with DELETE method type.

Trying to connect using gateway URL wss://{app-id}.execute-api.{region}.amazonaws.com/{stage} connected successfully but immediately disconnected.

It is working properly on the local server and on the client-server.

Is there any mistake in deploying the socket on Gateway?

0

There are 0 best solutions below