Skip to content

Commit

Permalink
Fix sockjs documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
cescoffier committed Oct 27, 2023
1 parent bbdc2ae commit 7b2efa6
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 7b2efa6

Please sign in to comment.