mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
[FEATURE][EXP] Возможность обрабатывать сообщения WebSocket...
This commit is contained in:
parent
0ff391778a
commit
f89fabaf11
1 changed files with 2 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue