Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Bridging event bus
package com.saffrontech.ws.vertx.problem;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.DeploymentOptions;
import io.vertx.core.Vertx;
import io.vertx.ext.apex.Router;
import io.vertx.ext.apex.handler.sockjs.BridgeOptions;
import io.vertx.ext.apex.handler.sockjs.SockJSHandler;
// curl http://localhost:8888/eventbus/info
public class Server extends AbstractVerticle {
public static void main(String[] args) {
Vertx vertx = Vertx.vertx();
vertx.deployVerticle(Server.class.getName(), new DeploymentOptions());
}
@Override
public void start() throws Exception {
Router router = Router.router(vertx);
SockJSHandler sockJSHandler = SockJSHandler.create(vertx);
BridgeOptions options = new BridgeOptions();
sockJSHandler.bridge(options);
router.route("/eventbus").handler(sockJSHandler);
vertx.createHttpServer().requestHandler(router::accept).listen(8888);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.