[FEATURE][EXP] Возможность обрабатывать сообщения WebSocket...

This commit is contained in:
Zaxar163 2019-09-27 19:31:09 +02:00
parent 0ff391778a
commit f89fabaf11
No known key found for this signature in database
GPG key ID: 1FE4F2E1F053831B

View file

@ -37,6 +37,7 @@
public class WebSocketService {
public final ChannelGroup channels;
public static ProviderMap<WebSocketServerResponse> providers = new ProviderMap<>();
public final BiHookSet<TextWebSocketFrame, ChannelHandlerContext> packetHook = new BiHookSet<>();
public static class WebSocketRequestContext
{
public WebSocketServerResponse response;
@ -64,6 +65,7 @@ public WebSocketService(ChannelGroup channels, LaunchServer server) {
private final Gson gson;
public void process(ChannelHandlerContext ctx, TextWebSocketFrame frame, Client client, String ip) {
if (packetHook.hook(frame, ctx)) return;
String request = frame.text();
WebSocketServerResponse response = gson.fromJson(request, WebSocketServerResponse.class);
process(ctx, response, client, ip);