diff --git a/docs/src/main/asciidoc/vertx-reference.adoc b/docs/src/main/asciidoc/vertx-reference.adoc index fdcc107d726fb..eed2eadb4d316 100644 --- a/docs/src/main/asciidoc/vertx-reference.adoc +++ b/docs/src/main/asciidoc/vertx-reference.adoc @@ -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; @@ -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())); } }