Add handler for HELLO websocket message
This commit is contained in:
parent
651700ca62
commit
76aad82883
@ -2,6 +2,11 @@ package fi.flexplex.lib;
|
||||
|
||||
public interface FlexLibAdapter {
|
||||
|
||||
/**
|
||||
* Called when WebSocket is connected and server responded HELLO
|
||||
*/
|
||||
public default void onWebSocketConnect() {}
|
||||
|
||||
/**
|
||||
* Called when player friend list or friend requests are updated
|
||||
* @param player
|
||||
|
@ -14,4 +14,9 @@ public final class FlexLibAdapterImpl implements FlexLibAdapter {
|
||||
this.flexLib.updatePlayerFriends(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWebSocketConnect() {
|
||||
this.flexLib.getLogger().info("WebSocket connected");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -76,6 +76,10 @@ public final class WebSocketClient {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "HELLO":
|
||||
for (final FlexLibAdapter listener : flexLib.getEventListeners()) {
|
||||
listener.onWebSocketConnect();
|
||||
}
|
||||
default:
|
||||
flexLib.getLogger().warning("Received invalid WebSocket message from FlexPlex. Message: " + args[0]);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user