public interface WebSocketBroadcaster
Modifier and Type | Method and Description |
---|---|
default <T> Publisher<T> |
broadcast(T message)
When used on the server this method will broadcast a message to all open WebSocket connections.
|
default <T> Publisher<T> |
broadcast(T message,
MediaType mediaType)
When used on the server this method will broadcast a message to all open WebSocket connections.
|
<T> Publisher<T> |
broadcast(T message,
MediaType mediaType,
Predicate<WebSocketSession> filter)
When used on the server this method will broadcast a message to all open WebSocket connections that match the given filter.
|
default <T> Publisher<T> |
broadcast(T message,
Predicate<WebSocketSession> filter)
When used on the server this method will broadcast a message to all open WebSocket connections that match the given filter.
|
default <T> CompletableFuture<T> |
broadcastAsync(T message)
When used on the server this method will broadcast a message to all open WebSocket connections.
|
default <T> CompletableFuture<T> |
broadcastAsync(T message,
MediaType mediaType)
When used on the server this method will broadcast a message to all open WebSocket connections.
|
default <T> CompletableFuture<T> |
broadcastAsync(T message,
MediaType mediaType,
Predicate<WebSocketSession> filter)
When used on the server this method will broadcast a message to all open WebSocket connections.
|
default <T> CompletableFuture<T> |
broadcastAsync(T message,
Predicate<WebSocketSession> filter)
When used on the server this method will broadcast a message to all open WebSocket connections that match the given filter.
|
default <T> void |
broadcastSync(T message)
When used on the server this method will broadcast a message to all open WebSocket connections.
|
default <T> void |
broadcastSync(T message,
MediaType mediaType)
When used on the server this method will broadcast a message to all open WebSocket connections.
|
default <T> void |
broadcastSync(T message,
MediaType mediaType,
Predicate<WebSocketSession> filter)
When used on the server this method will broadcast a message to all open WebSocket connections.
|
default <T> void |
broadcastSync(T message,
Predicate<WebSocketSession> filter)
When used on the server this method will broadcast a message to all open WebSocket connections that match the given filter.
|
<T> Publisher<T> broadcast(T message, MediaType mediaType, Predicate<WebSocketSession> filter)
Publisher
does not start sending until subscribed to.
If you return it from Micronaut annotated methods such as OnOpen
and OnMessage
,
Micronaut will subscribe to it and send the message without blocking.T
- The message typemessage
- The messagemediaType
- The media type of the message. Used to lookup an appropriate codec via the MediaTypeCodecRegistry
.filter
- The filter to applyPublisher
that either emits an error or emits the message once it has been published successfully.default <T> Publisher<T> broadcast(T message, MediaType mediaType)
Publisher
does not start sending until subscribed to.
If you return it from Micronaut annotated methods such as OnOpen
and OnMessage
,
Micronaut will subscribe to it and send the message without blocking.T
- The message typemessage
- The messagemediaType
- The media type of the message. Used to lookup an appropriate codec via the MediaTypeCodecRegistry
.Publisher
that either emits an error or emits the message once it has been published successfully.default <T> Publisher<T> broadcast(T message)
Publisher
does not start sending until subscribed to.
If you return it from Micronaut annotated methods such as OnOpen
and OnMessage
,
Micronaut will subscribe to it and send the message without blocking.T
- The message typemessage
- The messagePublisher
that either emits an error or emits the message once it has been published successfully.default <T> Publisher<T> broadcast(T message, Predicate<WebSocketSession> filter)
Publisher
does not start sending until subscribed to.
If you return it from Micronaut annotated methods such as OnOpen
and OnMessage
,
Micronaut will subscribe to it and send the message without blocking.T
- The message typemessage
- The messagefilter
- The filter to applyPublisher
that either emits an error or emits the message once it has been published successfully.default <T> CompletableFuture<T> broadcastAsync(T message, MediaType mediaType, Predicate<WebSocketSession> filter)
T
- The message typemessage
- The messagemediaType
- The media type of the message. Used to lookup an appropriate codec via the MediaTypeCodecRegistry
.filter
- The filterCompletableFuture
that tracks the execution. CompletableFuture.get()
and related methods will return the message on success, on error throw the underlying Exception.default <T> CompletableFuture<T> broadcastAsync(T message)
T
- The message typemessage
- The messageCompletableFuture
that tracks the execution. CompletableFuture.get()
and related methods will return the message on success, on error throw the underlying Exception.default <T> CompletableFuture<T> broadcastAsync(T message, Predicate<WebSocketSession> filter)
T
- The message typemessage
- The messagefilter
- The filter to applyCompletableFuture
that tracks the execution. CompletableFuture.get()
and related methods will return the message on success, on error throw the underlying Exception.default <T> CompletableFuture<T> broadcastAsync(T message, MediaType mediaType)
T
- The message typemessage
- The messagemediaType
- The media type of the message. Used to lookup an appropriate codec via the MediaTypeCodecRegistry
.CompletableFuture
that tracks the execution. CompletableFuture.get()
and related methods will return the message on success, on error throw the underlying Exception.default <T> void broadcastSync(T message, MediaType mediaType, Predicate<WebSocketSession> filter)
T
- The message typemessage
- The messagemediaType
- The media type of the message. Used to lookup an appropriate codec via the MediaTypeCodecRegistry
.filter
- The filterdefault <T> void broadcastSync(T message)
T
- The message typemessage
- The messagedefault <T> void broadcastSync(T message, Predicate<WebSocketSession> filter)
T
- The message typemessage
- The messagefilter
- The filter to applydefault <T> void broadcastSync(T message, MediaType mediaType)
T
- The message typemessage
- The messagemediaType
- The media type of the message. Used to lookup an appropriate codec via the MediaTypeCodecRegistry
.