mirror of
https://github.com/jwdeveloper/TikTokLiveJava.git
synced 2026-03-01 17:59:39 -05:00
Changes:
`onWebsocketMessage()` TikTokWebsocketMessageEvent new event that is triggered when new ProtocolBuffer message come from TikTok server. Should be mainly use for debuging purpose Bugs: - Fixed bug: WebcastSocialMessage was always triggering `TikTokShareEvent` events such as `TikTokLikeEvent`, `TikTokFollowEvent`, `TikTokShareEvent`, `TikTokJoinEvent` was ignored - Fixed bug: Websocket was disconnecting when there was no incoming events for the while. Fixed by implementing background loop that pinging TikTok server every few ms. - Fixed bug: Disconnect method was not working
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
package io.github.jwdeveloper.tiktok.utils;
|
||||
|
||||
import io.github.jwdeveloper.tiktok.exceptions.TikTokLiveException;
|
||||
|
||||
public class CancelationToken
|
||||
{
|
||||
private boolean isCanceled =false;
|
||||
|
||||
public void cancel()
|
||||
{
|
||||
isCanceled =true;
|
||||
}
|
||||
|
||||
public boolean isCancel()
|
||||
{
|
||||
|
||||
return isCanceled;
|
||||
}
|
||||
|
||||
public void throwIfCancel()
|
||||
{
|
||||
if(!isCanceled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
throw new TikTokLiveException("Token requested cancelation");
|
||||
}
|
||||
|
||||
public boolean isNotCancel()
|
||||
{
|
||||
return !isCancel();
|
||||
}
|
||||
|
||||
public static CancelationToken create()
|
||||
{
|
||||
return new CancelationToken();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user