Comments (10)
If you modify the following code in
src/app.rs
, can avoid losing messages occasionally.let client2 = self.danmu_client.clone(); let recv_msg = tokio::spawn(async move { loop { client2.lock().await.receive().await; // tokio::time::sleep(Duration::from_secs_f32(0.3)).await; tokio::time::sleep(Duration::from_secs_f32(0.01)).await; } });So that's some sync problem?
Actually yes, because there are 2 tasks that need to manipulate the client
, and the client
be protected by Mutex
. If we do not send a 'heartbeat' to the server within the 60s, the server would close the connection with us. So we have to sleep the receiving message task and release the Mutex
protecting the client
to make sure that the 'heartbeat' be sent within a reasonable time.
from bili-live-chat.
Yeah, I found this issue. Actually, if you use this to connect a live room that has a lot of audience, this will lose some messages. I will try to fix it in a couple of days.
from bili-live-chat.
I found I can't send danmaku in bilibili_live_tui sometimes but can do it in bili-live-chat.
That's weird!!!
bilibili_live_tui.1:
bilibili_live_tui.2:
bili-live-chat:
from bili-live-chat.
If you modify the following code in src/app.rs
, can avoid losing messages occasionally.
let client2 = self.danmu_client.clone();
let recv_msg = tokio::spawn(async move {
loop {
client2.lock().await.receive().await;
// tokio::time::sleep(Duration::from_secs_f32(0.3)).await;
tokio::time::sleep(Duration::from_secs_f32(0.01)).await;
}
});
from bili-live-chat.
If you modify the following code in
src/app.rs
, can avoid losing messages occasionally.let client2 = self.danmu_client.clone(); let recv_msg = tokio::spawn(async move { loop { client2.lock().await.receive().await; // tokio::time::sleep(Duration::from_secs_f32(0.3)).await; tokio::time::sleep(Duration::from_secs_f32(0.01)).await; } });
So that's some sync problem?
from bili-live-chat.
I send several messages using bilibili_live_tui, none of them fails. But I can't a single message using bili-live-chat, and there is no error message such as "发送弹幕失败".
from bili-live-chat.
And I found a possible reason that some messages can not be sent. That is caused by the data that do not be encoded by urlencode
.
from bili-live-chat.
At the branch dev 95402a0, the sync problem had been solved.
from bili-live-chat.
At the branch dev 95402a0, the sync problem had been solved.
I test it using roomId 23141761, it is ok but the messages box are refreshed once many seconds rather then fetched immediately (possibly due to the message frequency is very high in that room)
from bili-live-chat.
I found that when messages are sent very frequently, the Danmaku Receiver in the BiLiBiLi web client also has this problem.
from bili-live-chat.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bili-live-chat.