Skip to content

Commit

Permalink
Documentation update for netsocket/websocket writeHandlers
Browse files Browse the repository at this point in the history
Follows-up on #4625

Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
  • Loading branch information
tsegismont committed Feb 28, 2023
1 parent 2a6f057 commit 8d85845
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/main/asciidoc/http.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1896,12 +1896,14 @@ used with binary frames that are no split over multiple frames.

==== Event bus handlers

Every WebSocket automatically registers two handler on the event bus, and when any data are received in this handler,
it writes them to itself. Those are local subscriptions not routed on the cluster.
Every WebSocket can register two handlers on the event bus, and when any data are received in these handlers,
it writes the data to itself. Those are local subscriptions, not reachable from other clustered nodes.

This enables you to write data to a WebSocket which is potentially in a completely different verticle sending data
to the address of that handler.

This feature is disabled by default, however you can enable it using {@link io.vertx.core.http.HttpServerOptions#setRegisterWebSocketWriteHandlers} or {@link io.vertx.core.http.WebSocketConnectOptions#setRegisterWriteHandlers}.

The addresses of the handlers are given by {@link io.vertx.core.http.WebSocket#binaryHandlerID()} and
{@link io.vertx.core.http.WebSocket#textHandlerID()}.

Expand Down
8 changes: 5 additions & 3 deletions src/main/asciidoc/net.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,14 @@ exceptions that happens before the connection is passed to the {@link io.vertx.c

=== Event bus write handler

Every socket automatically registers a handler on the event bus, and when any buffers are received in this handler,
it writes them to itself. Those are local subscriptions not routed on the cluster.
Every socket can register a handler on the event bus, and when any buffers are received in this handler,
it writes them to itself. Those are local subscriptions, not reachable from other clustered nodes.

This enables you to write data to a socket which is potentially in a completely different verticle by sending the buffer to the address of that handler.

The address of the handler is given by {@link io.vertx.core.net.NetSocket#writeHandlerID()}
This feature is disabled by default, however you can enable it using {@link io.vertx.core.net.NetServerOptions#setRegisterWriteHandler} or {@link io.vertx.core.net.NetClientOptions#setRegisterWriteHandler}.

The address of the handler is given by {@link io.vertx.core.net.NetSocket#writeHandlerID()}.

=== Local and remote addresses

Expand Down

0 comments on commit 8d85845

Please sign in to comment.