I have an java vertx server and a JavaScript client. I want to create an event bus under twice but vertx respond : Error received on connection: access_denied
Javascript code:
var eventBus = new vertx.EventBus("http://localhost:8989/eventbus");
eventBus.onopen = function () {
console.log("Event bus connected !");
console.log(eventBus);
eventBus.registerHandler("http://localhost:8989/eventbus/news-feed", function (message) {
console.log("registred" + message.body());
});
Java code:
SockJSHandler bridge = SockJSHandler.create(vertx).bridge(new BridgeOptions());
router.route("/eventbus/*").handler(bridge);
router.route().handler(StaticHandler.create());// otherwise serve static pages
HttpServer httpServer = vertx.createHttpServer();
httpServer.requestHandler(router::accept);
httpServer.listen(Servers.SERVER_PORT);
vertx.setPeriodic(1000, event -> {
vertx.eventBus().publish("news-feed", "{\"c\":\"df\"}");
Have you an idea?
Regards