Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate chat events #17

Closed
therebelrobot opened this issue Mar 14, 2022 · 18 comments
Closed

Duplicate chat events #17

therebelrobot opened this issue Mar 14, 2022 · 18 comments

Comments

@therebelrobot
Copy link

Hi there! Great work on this, it was a lifesaver for me.

One issue I'm running into: when chat events come through, if there isn't immediate other chat messages to push it offscreen, those same chat events run again when it looks for more events (e.g. user 1 comments "hi" once, but the on("chat"... with that data comes through multiple times. I figured one way to filter it out was to grab the timestamp of the chat message and just make sure I keep a log of previously seen messages, but I can't seem to figure out where to find that kind of stamp info. Is there a way I could modify the lib myself locally to add that data? I tried adding msgId or timestamp to the proto for WebcastChatMessage but neither of those seem to have any affect on the results returned.

@zerodytrash
Copy link
Owner

hi,
this is a strange behavior. Have not experienced this problem before.
Can you check if a websocket connection is used? You can see this in the promise result of the connect() function.
Property: upgradedToWebsocket

@asdfg314284230
Copy link

Hello, I have encountered such a problem, may I ask if there is any way to fix it?

@zerodytrash
Copy link
Owner

The error did not occur in my case. If someone can reproduce the problem, feel free to fix it.

@asdfg314284230
Copy link

This may be related to my use of the system agent caused by repeated monitoring, SO far I have not been able to find the cause.

@asdfg314284230
Copy link

Or 3 or 8 repeat chat events can occur when the number of channels monitored is small.

@OlegShklyarov
Copy link

OlegShklyarov commented Apr 18, 2022

May I ask here? How to emit roomInfo from connectionWrapper?

	this.connection.getRoomInfo().then(roomInfo => {
		this.log(`HLS URL: ${roomInfo.stream_url.flv_pull_url.HD1}`);
		this.emit(`HLS URL: ${roomInfo.stream_url.flv_pull_url.HD1}`);
		})

Is this correct?

@pixorama
Copy link

The error did not occur in my case. If someone can reproduce the problem, feel free to fix it.

Yes, there is such a problem. It occurs in chats with a small number of participants.
I figured out how it happens. The query periodically returns cursor = 0, which causes the chat messages to be requested from the beginning.

I wrote a C# library similar to this one. In my implementation, I simply check that the new cursor is not equal to 0. If it is, then I ignore the query result and make a new one with the previous cursor.

@zerodytrash
Copy link
Owner

zerodytrash commented Apr 18, 2022

The error did not occur in my case. If someone can reproduce the problem, feel free to fix it.

Yes, there is such a problem. It occurs in chats with a small number of participants. I figured out how it happens. The query periodically returns cursor = 0, which causes the chat messages to be requested from the beginning.

I wrote a C# library similar to this one. In my implementation, I simply check that the new cursor is not equal to 0. If it is, then I ignore the query result and make a new one with the previous cursor.

The null cursor fix is already implemented:

if (webcastResponse.cursor) {
this.#clientParams.cursor = webcastResponse.cursor;
}

Let me know if the problem persists.

@zerodytrash
Copy link
Owner

May I ask here? How to emit roomInfo from connectionWrapper?

	this.connection.getRoomInfo().then(roomInfo => {
		this.log(`HLS URL: ${roomInfo.stream_url.flv_pull_url.HD1}`);
		this.emit(`HLS URL: ${roomInfo.stream_url.flv_pull_url.HD1}`);
		})

Is this correct?

Not sure what you want to do with the code. Please create a new issue since this has nothing to do with this issue.

@asdfg314284230
Copy link

asdfg314284230 commented Apr 18, 2022 via email

@asdfg314284230
Copy link

asdfg314284230 commented Apr 18, 2022 via email

@asdfg314284230
Copy link

asdfg314284230 commented Apr 18, 2022 via email

@Davincible
Copy link

Davincible commented May 25, 2022

@zerodytrash If you look at the proto contents of chat events there are a various types of IDs, I think you can use one of them to identify messages uniquely. I've looked at it briefly but not in-depth

@zerodytrash
Copy link
Owner

@zerodytrash If you look at there proto contents of chat events there are a various types of IDs, I think you can use one of them to identify messages uniquely. I've looked at it briefly but no in-depth

good point. does anyone still have problems with duplicate events?

@METAIRONY
Copy link

Hello, I ran into a problem with duplicate gift event

@zerodytrash
Copy link
Owner

Hello, I ran into a problem with duplicate gift event

make sure you handle gift streaks correctly
https://github.com/zerodytrash/TikTok-Live-Connector#gift

@zerodytrash
Copy link
Owner

There is a new event attribute msgId in the latest version which can be used to detect duplicates.

@artwl
Copy link

artwl commented Sep 22, 2022

I also encountered the problem of repeated gift messages today, and both msgId and createTime are not repeated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants