TikTok-Live-Connector icon indicating copy to clipboard operation
TikTok-Live-Connector copied to clipboard

suddenly connects, even though the user is offline (sometimes)

Open bakteribaik opened this issue 7 months ago • 2 comments

So I created the TikTok Live Connector as a tool to check whether this username is live or not within a certain period of time. This is what the code looks like

const { WebcastPushConnection } = require('tiktok-live-connector');

let tiktok = new WebCastPushConnection('username');
let connected = false;

setInterval(()=> {
  if(connected === true) return;
  tiktok.connect().then((stats) => console.log(stats.roomId)).catch((err) => console.error(err));
}, 60000);

tiktok.on('StreamEnd', () => {
  if(connected){
      connected = false;
  }
});

Sometimes this code runs very well, but sometimes it also reads that the user is live even though the user is offline. maybe someone has an idea about this?

bakteribaik avatar Dec 13 '23 11:12 bakteribaik