Skip to content

Commit

Permalink
Merge pull request #36741 from cescoffier/fix-sockjs-example
Browse files Browse the repository at this point in the history
Fix sockjs documentation
  • Loading branch information
cescoffier authored Oct 27, 2023
2 parents d76b8de + 7b2efa6 commit d110270
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions docs/src/main/asciidoc/vertx-reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ So use SockJS, you need to configure the bridge, especially the addresses that w

[source, java]
----
package org.acme.vertx;
package org.acme;
import io.vertx.core.Vertx;
import io.vertx.ext.bridge.PermittedOptions;
Expand All @@ -875,9 +875,13 @@ public class SockJsExample {
public void init(@Observes Router router) {
SockJSHandler sockJSHandler = SockJSHandler.create(vertx);
sockJSHandler.bridge(new SockJSBridgeOptions()
Router bridge = sockJSHandler.bridge(new SockJSBridgeOptions()
.addOutboundPermitted(new PermittedOptions().setAddress("ticks")));
router.route("/eventbus/*").handler(sockJSHandler);
router.route("/eventbus/*").subRouter(bridge);
AtomicInteger counter = new AtomicInteger();
vertx.setPeriodic(1000,
ignored -> vertx.eventBus().publish("ticks", counter.getAndIncrement()));
}
}
Expand Down

0 comments on commit d110270

Please sign in to comment.