Skip to content

Commit

Permalink
add subscribe event
Browse files Browse the repository at this point in the history
  • Loading branch information
zerodytrash committed Jun 30, 2022
1 parent 31e95c1 commit 31454c2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ const MessageEvents = {
ENVELOPE: 'envelope',
};

const CustomEvents = {
SUBSCRIBE: 'subscribe',
};

/**
* Wrapper class for TikTok's internal Webcast Push Service
*/
Expand Down Expand Up @@ -421,6 +425,9 @@ class WebcastPushConnection extends EventEmitter {
break;
case 'WebcastMemberMessage':
this.emit(MessageEvents.MEMBER, simplifiedObj);
if (simplifiedObj.actionId === 7) {
this.emit(CustomEvents.SUBSCRIBE, simplifiedObj);
}
break;
case 'WebcastGiftMessage':
// Add extended gift info if option enabled
Expand Down
1 change: 1 addition & 0 deletions src/proto/tiktokSchema.proto
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ message WebcastChatMessage {
message WebcastMemberMessage {
User user = 2;
WebcastMessageEvent event = 1;
int32 actionId = 10;
}

message WebcastGiftMessage {
Expand Down

0 comments on commit 31454c2

Please sign in to comment.