WebSocket disconnected event
This commit is contained in:
parent
b38a3201d3
commit
a9c0e24378
@ -5,7 +5,12 @@ public interface FlexLibAdapter {
|
||||
/**
|
||||
* Called when WebSocket is connected and server responded HELLO
|
||||
*/
|
||||
public default void onWebSocketConnect() {}
|
||||
public default void onWebSocketConnect() {}
|
||||
|
||||
/**
|
||||
* Called when WebSocket is disconnected
|
||||
*/
|
||||
public default void onWebSocketDisconnect() {}
|
||||
|
||||
/**
|
||||
* Called when player friend list or friend requests are updated
|
||||
|
@ -19,4 +19,9 @@ public final class FlexLibAdapterImpl implements FlexLibAdapter {
|
||||
this.flexLib.getLogger().info("WebSocket connected");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWebSocketDisconnect() {
|
||||
this.flexLib.getLogger().info("WebSocket disconnected");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -34,6 +34,9 @@ public final class WebSocketClient {
|
||||
|
||||
protected void disable() {
|
||||
this.webSocket.disconnect();
|
||||
for (final FlexLibAdapter listener : this.flexLib.getEventListeners()) {
|
||||
listener.onWebSocketDisconnect();
|
||||
}
|
||||
}
|
||||
|
||||
private WebSocket createWebSocket(final String url, final String token) throws IOException {
|
||||
|
Loading…
Reference in New Issue
Block a user