mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
two improves of live room danmu (#5)
* feat: use wss instead of tcp connect * feat: fallback to next server when live room danmu server connect failed
This commit is contained in:
@@ -142,12 +142,15 @@ class LiveRoomController extends GetxController {
|
||||
if (v['status']) {
|
||||
LiveDanmakuInfo info = v['data'];
|
||||
// logger.d("info => $info");
|
||||
List<String> servers = [];
|
||||
for (final host in info.data.hostList) {
|
||||
servers.add('wss://${host.host}:${host.wssPort}/sub');
|
||||
}
|
||||
msgStream = LiveMessageStream(
|
||||
streamToken: info.data.token,
|
||||
roomId: roomId,
|
||||
uid: GStorage.userInfo.get('userInfoCache')?.mid ?? 0,
|
||||
host: info.data.hostList[0].host,
|
||||
port: info.data.hostList[0].port,
|
||||
servers: servers,
|
||||
);
|
||||
msgStream?.addEventListener((obj) {
|
||||
if (obj['cmd'] == 'DANMU_MSG') {
|
||||
|
||||
Reference in New Issue
Block a user