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

stomp path must be a regex instead of string #38

Open
am-kram opened this issue May 9, 2018 · 2 comments
Open

stomp path must be a regex instead of string #38

am-kram opened this issue May 9, 2018 · 2 comments

Comments

@am-kram
Copy link

am-kram commented May 9, 2018

https://github.com/vert-x3/vertx-stomp/blob/master/src/main/java/io/vertx/ext/stomp/impl/StompServerImpl.java#L217

due to this - can't use stomp with sockjs as sock js adds: /stomp/<rand id 1>/<rand id 2>/websocket
to the websocket url.

Additionally, there is no degradation of websocket to xhr supported.

@cescoffier
Copy link
Member

You can use the sockJS bridge to support degradation.

About the regex, that's a good idea. Fancy a PR?

@am-kram
Copy link
Author

am-kram commented May 10, 2018

I will make a pr - i tested the regex functionality - it works but for some reason i am not receiving any messages when i send via a stomp client (even for a simplepath).

I see it receives the connection - but after that, the receivedHandler is never invoked. Is there a working example of stomp over sockjs websocket that you could point me to?

    Router router = Router.router(vertx);

    StompServer server = StompServer.create(vertx, new StompServerOptions()
      .setPort(-1) // Disable the TCP port, optional
      .setWebsocketBridge(true) // Enable the web socket support
      .setWebsocketPath("/stomp")) // Configure the web socket path, /stomp by default
      .handler(StompServerHandler.create(vertx).receivedFrameHandler(sf ->{
          System.out.println(sf.frame().getBodyAsString());
          logger.info(sf.frame().getBodyAsString());
      }));

    HttpServer http = vertx.createHttpServer(
            new HttpServerOptions().setWebsocketSubProtocols("v10.stomp, v11.stomp")
    )
      .websocketHandler(server.webSocketHandler())
      .requestHandler(router::accept)
      .listen(8080);

I tried this as well - not seeing any messages

    StompServer server = StompServer.create(vertx, new StompServerOptions()
      .setPort(-1) // Disable the TCP port, optional
      .setWebsocketBridge(true) // Enable the web socket support
      .setWebsocketPath("/stomp")) // Configure the web socket path, /stomp by default
      .handler(StompServerHandler.create(vertx).stompHandler(sf ->{
          System.out.println(sf.frame().getBodyAsString());
          logger.info(sf.frame().getBodyAsString());
      }));

I also commented #34 (comment)
Basically, stomp over sockjs or just stomp over websocket seems hard to get it to work. I am trying to port a spring boot based stomp impl to vertx.

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

No branches or pull requests

2 participants