Quarkus

netty-socket-io.hostname=localhost
netty-socket-io.port=9092
netty-socket-io.ping-timeout=60000
netty-socket-io.ping-interval=25000

Main Application

@ApplicationScoped
public class QuarkusMainApplication {
    
    @Inject
    SocketIOServer server;
    
    void onStart(@Observes StartupEvent ev) {
        // Add event listeners
        server.addEventListener("chatevent", ChatMessage.class, (client, data, ackRequest) -> {
            server.getBroadcastOperations().sendEvent("chatevent", data);
        });
        
        server.start();
        log.info("Socket.IO server started on port {}", server.getConfiguration().getPort());
    }
    
    void onStop(@Observes ShutdownEvent ev) {
        server.stop();
    }
}

Event Handlers

Full Example

See the complete example in the netty-socketio-examples-quarkus-base module.

Last updated

Was this helpful?