mirror of
https://github.com/jwdeveloper/TikTokLiveJava.git
synced 2026-02-27 08:49:40 -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:
@@ -88,7 +88,7 @@ public interface TikTokEventBuilder<T> {
|
||||
|
||||
T onEvent(TikTokEventConsumer<TikTokEvent> event);
|
||||
|
||||
T onSuccessResponseMapping(TikTokEventConsumer<TikTokSuccessResponseMappingEvent> event);
|
||||
T onWebsocketMessage(TikTokEventConsumer<TikTokWebsocketMessageEvent> event);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -5,9 +5,13 @@ import io.github.jwdeveloper.tiktok.messages.WebcastResponse;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* Happens when TikTok websocket receive message from server
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class TikTokSuccessResponseMappingEvent extends TikTokEvent
|
||||
public class TikTokWebsocketMessageEvent extends TikTokEvent
|
||||
{
|
||||
private TikTokEvent event;
|
||||
|
||||
@@ -3,7 +3,6 @@ package io.github.jwdeveloper.tiktok.live;
|
||||
public interface LiveRoomInfo
|
||||
{
|
||||
int getViewersCount();
|
||||
|
||||
String getRoomId();
|
||||
String getUserName();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -414,13 +414,16 @@ message User {
|
||||
Picture profilePicture = 9; // Avatar
|
||||
Picture picture720 = 10; // 720p
|
||||
Picture picture1080 = 11; // 1080p
|
||||
uint32 data2 = 15;
|
||||
uint64 data3 = 16;
|
||||
int32 status = 15;
|
||||
int64 createTime = 16;
|
||||
int64 modifyTime = 17;
|
||||
int32 secret = 18;
|
||||
string shareQrcodeUri = 19;
|
||||
repeated Picture additionalPictures = 21;
|
||||
FollowerData followerData = 22;
|
||||
string userString1 = 23;
|
||||
// string userString1 = 23;
|
||||
UserRanking userRank1 = 25;
|
||||
string userString2 = 32;
|
||||
// string userString2 = 32;
|
||||
uint64 data4 = 37;
|
||||
string uniqueId = 38; // @-ID for user
|
||||
string data5 = 46;
|
||||
|
||||
Reference in New Issue
Block a user