public class Server<T extends ExecutionContext>
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
void |
broadcast(Message message)
Broadcast the given message to all connections.
|
int |
broadcast(Message message,
java.util.function.Predicate<Connection> predicate)
Broadcast a message to all connections that fulfill the given predicate.
|
int |
getConnectionCount() |
void |
start()
Start listening for inbound connections.
|
void |
stop()
Stop listening for inbound connections and attempt to gracefully close all existing connections.
|
public void stop()
public void start()
public void broadcast(Message message)
message
- The message to be broadcast.public int broadcast(Message message, java.util.function.Predicate<Connection> predicate)
message
- The message to be broadcast.predicate
- The predicate which, if fulfilled, will cause a message to be broadcast by the given
connection.public int getConnectionCount()