Remove -1 close code and convert to standard public static value with reference!

This commit is contained in:
kohlerpop1
2025-09-16 20:53:54 -04:00
parent 54433af65f
commit 19ed45e6de
3 changed files with 12 additions and 2 deletions

View File

@@ -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;
}
}