public final class NettyConnection extends Object implements ClientConnection
Constructor and Description |
---|
NettyConnection(Client.WithManagement client,
@NonNull io.netty.channel.ChannelFuture channelFuture,
@NonNull Consumer<Client.WithManagement> shutdownHook)
Constructs a Netty connection.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isAlive()
Gets if the connection is alive.
|
void |
shutdown(DefaultMessageType messageType,
boolean reconnect)
Shuts down with a message type.
|
void |
shutdown(@Nullable String message,
boolean reconnect)
Shuts down with a message.
|
void |
startPing()
Starts sending pings.
|
@NonNull String |
toString() |
public NettyConnection(Client.WithManagement client, @NonNull io.netty.channel.ChannelFuture channelFuture, @NonNull Consumer<Client.WithManagement> shutdownHook)
client
- client for which this existschannelFuture
- channel future from which to handle the connectionshutdownHook
- consumer to call when shut downpublic boolean isAlive()
ClientConnection
isAlive
in interface ClientConnection
public void startPing()
ClientConnection
startPing
in interface ClientConnection
public void shutdown(DefaultMessageType messageType, boolean reconnect)
ClientConnection
shutdown
in interface ClientConnection
messageType
- message typereconnect
- true to indicate desire to reconnectpublic void shutdown(@Nullable String message, boolean reconnect)
ClientConnection
shutdown
in interface ClientConnection
message
- messagereconnect
- true to indicate desire to reconnectCopyright © 2013–2021 Kitteh. All rights reserved.