Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling stompServer.close() has no effect #96

Closed
mikadev opened this issue Dec 2, 2024 · 3 comments
Closed

Calling stompServer.close() has no effect #96

mikadev opened this issue Dec 2, 2024 · 3 comments
Assignees
Labels

Comments

@mikadev
Copy link

mikadev commented Dec 2, 2024

Calling stompServer.rxClose() or stompServer.close() after server start listen has no effect on active connection and also accept new connections

public class StompWsBasic2 extends AbstractVerticle {
    private HttpServer httpServer;

    public static void main(String[] args) {
        Vertx.vertx().deployVerticle(new StompWsBasic2());
    }

    @Override
    public void start() throws Exception {
        super.start();

        StompServerHandler stompServerHandler = StompServerHandler.create(vertx);

        StompServer stompServer = StompServer.create(vertx, new StompServerOptions()
                        .setHeartbeat(new JsonObject().put("x", 5000).put("y", 5000))
                        .setPort(-1) // Disable the TCP port, optional
                        .setWebsocketBridge(true)// Enable the web socket support
                        .setWebsocketPath("/stomp"))
                .handler(stompServerHandler)
                .writingFrameHandler(sf -> {
                    System.out.println(sf.frame());
                });

        
        httpServer = vertx.createHttpServer(
                new HttpServerOptions().setWebSocketSubProtocols(Arrays.asList("v10.stomp", "v11.stomp", "v12.stomp"))
        );

        httpServer
                .webSocketHandler(stompServer.webSocketHandler())
                .listen(8087)
                .subscribe();

        vertx.setTimer(5000, e -> {
            stompServer.rxClose()
                    .doOnComplete(() -> System.err.println("close stompServer"))
                    .subscribe();
        });
    }
}
@mikadev mikadev added the bug label Dec 2, 2024
@vietj vietj added this to the 4.5.12 milestone Dec 2, 2024
@tsegismont tsegismont self-assigned this Jan 2, 2025
@tsegismont tsegismont removed the bug label Jan 6, 2025
@tsegismont tsegismont removed this from the 4.5.12 milestone Jan 6, 2025
@tsegismont
Copy link
Contributor

This is not a bug. In this case the stomp server is only used as bridge and no TCP server is started.

You should close the HTTP server to stop handling connections.

@tsegismont tsegismont closed this as not planned Won't fix, can't repro, duplicate, stale Jan 6, 2025
@mikadev
Copy link
Author

mikadev commented Jan 6, 2025

Ok i understand thanks for replying, but what the purpose of the stompServer.rxClose() in this case ? (btw if i don't use timer the stomp will yes stopped and will not accept any further connection so are you sure about ?) @tsegismont

@tsegismont
Copy link
Contributor

When used as a bridge for websockets, invoking close is not necessary (in fact, it doesn't perform any action).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants