Package dev.qixils.crowdcontrol.socket
Class ServerSocketManager
- java.lang.Object
-
- dev.qixils.crowdcontrol.socket.ServerSocketManager
-
- All Implemented Interfaces:
Respondable
,SocketManager
@AvailableSince("3.0.0") public final class ServerSocketManager extends Object implements SocketManager
Manages the connection to Crowd Control clients.- Since:
- 3.0.0
-
-
Constructor Summary
Constructors Constructor Description ServerSocketManager(@NotNull RequestManager crowdControl)
Creates a new server-side socket manager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addConnectListener(@NotNull Consumer<SocketManager> consumer)
void
addLoginListener(@NotNull Consumer<SocketManager> consumer)
@NotNull Response.Builder
buildResponse()
@NotNull List<? extends SocketManager>
getConnections()
@NotNull String
getDisplayName()
@NotNull Set<Request.Source>
getSources()
boolean
isClosed()
void
shutdown(@Nullable Request cause, @Nullable String reason)
void
write(@NotNull Response response)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface dev.qixils.crowdcontrol.socket.SocketManager
getSource, shutdown, shutdown
-
-
-
-
Constructor Detail
-
ServerSocketManager
@CheckReturnValue @Internal @AvailableSince("3.0.0") public ServerSocketManager(@NotNull @NotNull RequestManager crowdControl)
Creates a new server-side socket manager. This is intended only for use by the library.- Parameters:
crowdControl
- Crowd Control instance- Since:
- 3.0.0
-
-
Method Detail
-
addConnectListener
public void addConnectListener(@NotNull @NotNull Consumer<SocketManager> consumer)
- Specified by:
addConnectListener
in interfaceSocketManager
-
addLoginListener
public void addLoginListener(@NotNull @NotNull Consumer<SocketManager> consumer)
- Specified by:
addLoginListener
in interfaceSocketManager
-
buildResponse
public @NotNull Response.Builder buildResponse()
- Specified by:
buildResponse
in interfaceRespondable
- Specified by:
buildResponse
in interfaceSocketManager
-
shutdown
@AvailableSince("3.1.0") public void shutdown(@Nullable @Nullable Request cause, @Nullable @Nullable String reason) throws IOException
- Specified by:
shutdown
in interfaceSocketManager
- Throws:
IOException
-
getSources
@NotNull public @NotNull Set<Request.Source> getSources()
- Specified by:
getSources
in interfaceSocketManager
-
getConnections
@NotNull public @NotNull List<? extends SocketManager> getConnections()
- Specified by:
getConnections
in interfaceSocketManager
-
isClosed
public boolean isClosed()
- Specified by:
isClosed
in interfaceSocketManager
-
write
public void write(@NotNull @NotNull Response response) throws IOException
- Specified by:
write
in interfaceSocketManager
- Throws:
IOException
-
getDisplayName
@NotNull public @NotNull String getDisplayName()
- Specified by:
getDisplayName
in interfaceSocketManager
-
-