mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 11:39:11 +03:00
[FIX] WebSocket ping
This commit is contained in:
parent
3c5a83736b
commit
e1eaad2cd0
1 changed files with 5 additions and 0 deletions
|
@ -6,6 +6,8 @@
|
||||||
import io.netty.util.CharsetUtil;
|
import io.netty.util.CharsetUtil;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class WebSocketClientHandler extends SimpleChannelInboundHandler<Object> {
|
public class WebSocketClientHandler extends SimpleChannelInboundHandler<Object> {
|
||||||
|
|
||||||
private final WebSocketClientHandshaker handshaker;
|
private final WebSocketClientHandshaker handshaker;
|
||||||
|
@ -30,6 +32,9 @@ public void handlerAdded(final ChannelHandlerContext ctx) throws Exception {
|
||||||
public void channelActive(final ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(final ChannelHandlerContext ctx) throws Exception {
|
||||||
handshaker.handshake(ctx.channel());
|
handshaker.handshake(ctx.channel());
|
||||||
clientJSONPoint.onOpen();
|
clientJSONPoint.onOpen();
|
||||||
|
ctx.executor().schedule(() -> {
|
||||||
|
ctx.channel().writeAndFlush(new PingWebSocketFrame());
|
||||||
|
}, 20L, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue