mirror of
https://github.com/jwdeveloper/TikTokLiveJava.git
synced 2026-02-27 16:59:39 -05:00
Remove -1 close code and convert to standard public static value with reference!
This commit is contained in:
@@ -30,6 +30,8 @@ import lombok.Getter;
|
||||
@Getter
|
||||
@EventMeta(eventType = EventType.Control)
|
||||
public class TikTokDisconnectedEvent extends TikTokLiveClientEvent {
|
||||
public static int UNKNOWN_CLOSE_CODE = -1;
|
||||
|
||||
/** Valid CloseFrame code or -1 for unknown */
|
||||
private final int code;
|
||||
private final String reason;
|
||||
@@ -38,4 +40,12 @@ public class TikTokDisconnectedEvent extends TikTokLiveClientEvent {
|
||||
this.code = code;
|
||||
this.reason = reason.isBlank() ? "None" : reason;
|
||||
}
|
||||
|
||||
public TikTokDisconnectedEvent(String reason) {
|
||||
this(UNKNOWN_CLOSE_CODE, reason);
|
||||
}
|
||||
|
||||
public boolean isUnknownCloseCode() {
|
||||
return this.code == UNKNOWN_CLOSE_CODE;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user