Package org.spincast.plugins.undertow
Class SpincastUndertowWebsocketEndpointWriter
java.lang.Object
org.spincast.plugins.undertow.SpincastUndertowWebsocketEndpointWriter
- All Implemented Interfaces:
UndertowWebsocketEndpointWriter
public class SpincastUndertowWebsocketEndpointWriter
extends Object
implements UndertowWebsocketEndpointWriter
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static interface
Interface to create a write executor. -
Field Summary
-
Constructor Summary
ConstructorDescriptionSpincastUndertowWebsocketEndpointWriter
(Map<String, io.undertow.websockets.core.WebSocketChannel> channels, SpincastUndertowConfig spincastUndertowConfig) Constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected byte[]
protected SpincastUndertowConfig
void
sendClosingConnection
(int closingCode, String closingReason, Set<String> peerIds, ClosedEventSentCallback callback) Sends a "closing connection" message to specified peers.void
sendMessage
(Set<String> peerIds, byte[] bytes, WebsocketPeersWriteCallback callback) Sends a byte array message to specific peers.void
sendMessage
(Set<String> peerIds, String message, WebsocketPeersWriteCallback callback) Sends a String message to specific peers.void
sendPings
(WebsocketPeersWriteCallback callback) Sends aping
message to all peers.void
write
(Set<String> peerIds, SpincastUndertowWebsocketEndpointWriter.IWriteExecutor executor) Calls the executor's write(...) method for each peers and, when all asynchrounous calls are done, calls its writeErrors(...) with the ids of the peers for which the write failed with an IOException.
-
Field Details
-
logger
protected static final org.slf4j.Logger logger
-
-
Constructor Details
-
SpincastUndertowWebsocketEndpointWriter
public SpincastUndertowWebsocketEndpointWriter(Map<String, io.undertow.websockets.core.WebSocketChannel> channels, SpincastUndertowConfig spincastUndertowConfig) Constructor
-
-
Method Details
-
getChannelsMap
-
getSpincastUndertowConfig
-
getPingBytes
protected byte[] getPingBytes() -
sendPings
Description copied from interface:UndertowWebsocketEndpointWriter
Sends aping
message to all peers.- Specified by:
sendPings
in interfaceUndertowWebsocketEndpointWriter
-
sendMessage
Description copied from interface:UndertowWebsocketEndpointWriter
Sends a String message to specific peers.- Specified by:
sendMessage
in interfaceUndertowWebsocketEndpointWriter
-
sendMessage
Description copied from interface:UndertowWebsocketEndpointWriter
Sends a byte array message to specific peers.- Specified by:
sendMessage
in interfaceUndertowWebsocketEndpointWriter
-
sendClosingConnection
public void sendClosingConnection(int closingCode, String closingReason, Set<String> peerIds, ClosedEventSentCallback callback) Description copied from interface:UndertowWebsocketEndpointWriter
Sends a "closing connection" message to specified peers. No exception thrown if the message can't be sent.- Specified by:
sendClosingConnection
in interfaceUndertowWebsocketEndpointWriter
-
write
public void write(Set<String> peerIds, SpincastUndertowWebsocketEndpointWriter.IWriteExecutor executor) Calls the executor's write(...) method for each peers and, when all asynchrounous calls are done, calls its writeErrors(...) with the ids of the peers for which the write failed with an IOException.
-