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 {
|
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
|
* Called when player friend list or friend requests are updated
|
||||||
* @param player
|
* @param player
|
||||||
|
@ -14,4 +14,9 @@ public final class FlexLibAdapterImpl implements FlexLibAdapter {
|
|||||||
this.flexLib.updatePlayerFriends(player);
|
this.flexLib.updatePlayerFriends(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onWebSocketConnect() {
|
||||||
|
this.flexLib.getLogger().info("WebSocket connected");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,10 @@ public final class WebSocketClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "HELLO":
|
||||||
|
for (final FlexLibAdapter listener : flexLib.getEventListeners()) {
|
||||||
|
listener.onWebSocketConnect();
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
flexLib.getLogger().warning("Received invalid WebSocket message from FlexPlex. Message: " + args[0]);
|
flexLib.getLogger().warning("Received invalid WebSocket message from FlexPlex. Message: " + args[0]);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user