Demo:
tiktokLiveConnection.on('chat', data => {
if (data.comment.toLowerCase() === 'dice') {
let diceResult = Math.ceil(Math.random() * 6);
tiktokLiveConnection.sendMessage(@${data.uniqueId} you rolled a ${diceResult}).catch(err => console.error(err));
}
console.log(${data.uniqueId} (userId:${data.userId}) writes: ${data.comment});
})
Error:
jokerbackert (userId:7168509739276485637) writes: dice
Error: Failed to send chat message. Request failed with status code 403
at WebcastPushConnection.sendMessage (C:\Users\86181\npm_project\node_modules\tiktok-live-connector\dist\index.js:423:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
I have tested and the error happened here:
\node_modules\tiktok-live-connector\dist\index.js: at about 400
this line arror :
let response = await _classPrivateFieldGet(this, _httpClient).postFormDataToWebcastApi('room/chat/', requestParams, null); // Success?
I have checked the sessionId I got it from: browser-F12-application-cookies-tiktok-sessionid: xxxxxxxxxxxxxxxx
Just failed using demo.
I am in China,I use VPN but I did not set proxy, because I use merlin router VPN. Now I am going to test this on my foreign server.
I am not a guy wish free help. I donated by papal last year. And I will donate more from now on. Because I am learning javascript now. And hop[e using this product making money. ^_^
when I use sendmessage demo,problems came out:
Demo: tiktokLiveConnection.on('chat', data => { if (data.comment.toLowerCase() === 'dice') { let diceResult = Math.ceil(Math.random() * 6); tiktokLiveConnection.sendMessage(
@${data.uniqueId} you rolled a ${diceResult}
).catch(err => console.error(err)); } console.log(${data.uniqueId} (userId:${data.userId}) writes: ${data.comment}
); })Error: jokerbackert (userId:7168509739276485637) writes: dice Error: Failed to send chat message. Request failed with status code 403 at WebcastPushConnection.sendMessage (C:\Users\86181\npm_project\node_modules\tiktok-live-connector\dist\index.js:423:13) at processTicksAndRejections (node:internal/process/task_queues:96:5)
I have tested and the error happened here: \node_modules\tiktok-live-connector\dist\index.js: at about 400 this line arror : let response = await _classPrivateFieldGet(this, _httpClient).postFormDataToWebcastApi('room/chat/', requestParams, null); // Success?
I have checked the sessionId I got it from: browser-F12-application-cookies-tiktok-sessionid: xxxxxxxxxxxxxxxx Just failed using demo. I am in China,I use VPN but I did not set proxy, because I use merlin router VPN. Now I am going to test this on my foreign server.