Node.js library to receive live stream chat events like comments and gifts in realtime from TikTok LIVE.

Overview

TikTok-Live-Connector

A Node.js library to receive live stream events such as comments and gifts in realtime from TikTok LIVE by connecting to TikTok's internal WebCast push service. The package includes a wrapper that connects to the WebCast service using just the username (uniqueId). This allows you to connect to your own live chat as well as the live chat of other streamers. No credentials are required. Besides Chat Comments, other events such as Members Joining, Gifts, Viewers, Follows, Shares, Questions, Likes and Battles can be tracked. You can also send automatic messages into the chat by providing your Session ID.

Demo Project: https://tiktok-chat-reader.zerody.one/

Do you prefer other programming languages?

NOTE: This is not an official API. It's a reverse engineering project.

NOTE: This JavaScript library is intended for use in Node.js environments. If you want to process or display the data in the browser (client-side), you need to transfer the data from the Node.js environment to the browser. A good approach for this is to use Socket.IO or a different low-latency communication framework. A complete example project can be found here: TikTok-Chat-Reader

Overview

Getting started

  1. Install the package via NPM
npm i tiktok-live-connector
  1. Create your first chat connection
const { WebcastPushConnection } = require('tiktok-live-connector');

// Username of someone who is currently live
let tiktokUsername = "officialgeilegisela";

// Create a new wrapper object and pass the username
let tiktokChatConnection = new WebcastPushConnection(tiktokUsername);

// Connect to the chat (await can be used as well)
tiktokChatConnection.connect().then(state => {
    console.info(`Connected to roomId ${state.roomId}`);
}).catch(err => {
    console.error('Failed to connect', err);
})

// Define the events that you want to handle
// In this case we listen to chat messages (comments)
tiktokChatConnection.on('chat', data => {
    console.log(`${data.uniqueId} (userId:${data.userId}) writes: ${data.comment}`);
})

// And here we receive gifts sent to the streamer
tiktokChatConnection.on('gift', data => {
    console.log(`${data.uniqueId} (userId:${data.userId}) sends ${data.giftId}`);
})

// ...and more events described in the documentation below

Params and options

To create a new WebcastPushConnection object the following parameters are required.

WebcastPushConnection(uniqueId, [options])

Param Name Required Description
uniqueId Yes The unique username of the broadcaster. You can find this name in the URL.
Example: https://www.tiktok.com/@officialgeilegisela/live => officialgeilegisela
options No Here you can set the following optional connection properties. If you do not specify a value, the default value will be used.

processInitialData (default: true)
Define if you want to process the initital data which includes old messages of the last seconds.

fetchRoomInfoOnConnect (default: true)
Define if you want to fetch all room information on connect(). If this option is enabled, the connection to offline rooms will be prevented. If enabled, the connect result contains the room info via the roomInfo attribute. You can also manually retrieve the room info (even in an unconnected state) using the getRoomInfo() function.

enableExtendedGiftInfo (default: false)
Define if you want to receive extended information about gifts like gift name, cost and images. This information will be provided at the gift event.

enableWebsocketUpgrade (default: true)
Define if you want to use a WebSocket connection instead of request polling if TikTok offers it.

requestPollingIntervalMs (default: 1000)
Request polling interval if WebSocket is not used.

sessionId (default: null)
Here you can specify the current Session ID of your TikTok account (sessionid cookie value) if you want to send automated chat messages via the sendMessage() function. See Example

clientParams (default: {})
Custom client params for Webcast API.

requestHeaders (default: {})
Custom request headers passed to axios.

websocketHeaders (default: {})
Custom websocket headers passed to websocket.client.

requestOptions (default: {})
Custom request options passed to axios. Here you can specify an httpsAgent to use a proxy and a timeout value. See Example.

websocketOptions (default: {})
Custom websocket options passed to websocket.client. Here you can specify an agent to use a proxy and a timeout value. See Example.

Example Options:

let tiktokChatConnection = new WebcastPushConnection(tiktokUsername, {
    processInitialData: false,
    enableExtendedGiftInfo: true,
    enableWebsocketUpgrade: true,
    requestPollingIntervalMs: 2000,
    clientParams: {
        "app_language": "en-US",
        "device_platform": "web"
    },
    requestHeaders: {
        "headerName": "headerValue"
    },
    websocketHeaders: {
        "headerName": "headerValue"
    },
    requestOptions: {
        timeout: 10000
    },
    websocketOptions: {
        timeout: 10000
    }
});

Methods

A WebcastPushConnection object contains the following methods.

Method Name Description
connect Connects to the live stream chat.
Returns a Promise which will be resolved when the connection is successfully established.
disconnect Disconnects the connection.
getState Gets the current connection state including the cached room info (see below).
getRoomInfo Gets the current room info from TikTok API including streamer info, room status and statistics.
Returns a Promise which will be resolved when the API request is done.
Note: You can call this function even if you're not connected.
Example
getAvailableGifts Gets a list of all available gifts including gift name, image url, diamont cost and a lot of other information.
Returns a Promise that will be resolved when all available gifts has been retrieved from the API.
Note: You can call this function even if you're not connected.
Example
sendMessage
(text, [sessionId])
Sends a chat message into the current live room using the provided session cookie (specified in the constructor options or via the second function parameter).
Returns a Promise that will be resolved when the chat message has been submitted to the API.

WARNING: Use of this function is at your own risk. Spamming messages can lead to the suspension of your TikTok account. Be careful!
Example

Events

A WebcastPushConnection object has the following events which can be handled via .on(eventName, eventHandler)

Control Events:

Message Events:

Control Events

connected

Triggered when the connection gets successfully established.

tiktokChatConnection.on('connected', state => {
    console.log('Hurray! Connected!', state);
})

disconnected

Triggered when the connection gets disconnected. In that case you can call connect() again to have a reconnect logic. Note that you should wait a little bit before attempting a reconnect to to avoid being rate-limited.

tiktokChatConnection.on('disconnected', () => {
    console.log('Disconnected :(');
})

streamEnd

Triggered when the live stream gets terminated by the host. Will also trigger the disconnected event.

tiktokChatConnection.on('streamEnd', () => {
    console.log('Stream ended');
})

rawData

Triggered every time a protobuf encoded webcast message arrives. You can deserialize the binary object depending on the use case with protobufjs.

tiktokChatConnection.on('rawData', (messageTypeName, binary) => {
    console.log(messageTypeName, binary);
})

websocketConnected

Will be triggered as soon as a websocket connection is established. The websocket client object is passed.

tiktokChatConnection.on('websocketConnected', websocketClient => {
    console.log("Websocket:", websocketClient.connection);
})

error

General error event. You should handle this.

tiktokChatConnection.on('error', err => {
    console.error('Error!', err);
})

Message Events

member

Triggered every time a new viewer joins the live stream.

tiktokChatConnection.on('member', data => {
    console.log(`${data.uniqueId} joins the stream!`);
})

Data structure:

{
  userId: '6776663624629974021',
  uniqueId: 'zerodytester',
  nickname: 'Zerody One',
  profilePictureUrl: 'https://p16-sign-va.tiktokcdn.com/...',
  followRole: 1, // 0 = none; 1 = follower; 2 = friends
  userBadges: [] // e.g. Moderator badge
}

chat

Triggered every time a new chat comment arrives.

tiktokChatConnection.on('chat', data => {
    console.log(`${data.uniqueId} writes: ${data.comment}`);
})

Data structure:

{
    comment: 'how are you?',
    userId: '6776663624629974121',
    uniqueId: 'zerodytester',
    nickname: 'Zerody One',
    profilePictureUrl: 'https://p16-sign-va.tiktokcdn.com/...',
    followRole: 2, // 0 = none; 1 = follower; 2 = friends
    userBadges: [
        {
            type: 'pm_mt_moderator_im', 
            name: 'Moderator'
        }
    ]
}

gift

Triggered every time a gift arrives. You will receive additional information via the extendedGiftInfo attribute when you enable the enableExtendedGiftInfo option.

NOTE: Users have the capability to send gifts in a streak. This increases the repeatCount value until the user terminates the streak. During this time new gift events are triggered again and again with an increased repeatCount value. It should be noted that after the end of the streak, another gift event is triggered, which signals the end of the streak via repeatEnd:true. This applies only to gifts with giftType:1. This means that even if the user sends a giftType:1 gift only once, you will receive the event twice. Once with repeatEnd:false and once with repeatEnd:true. Therefore, the event should be handled as follows:

tiktokChatConnection.on('gift', data => {
    if (data.giftType === 1 && !data.repeatEnd) {
        // Streak in progress => show only temporary
        console.log(`${data.uniqueId} is sending gift ${data.giftName} x${data.repeatCount}`);
    } else {
        // Streak ended or non-streakable gift => process the gift with final repeat_count
        console.log(`${data.uniqueId} has sent gift ${data.giftName} x${data.repeatCount}`);
    }
})

Data structure:

{
  // Sender Details
  userId: '6976651226482787334',
  uniqueId: 'zerodytester',
  nickname: 'Zerody One',
  followRole: 0,
  userBadges: [],
  profilePictureUrl: 'https://p16-sign.tiktokcdn-us.com/...',  
  
  // Gift Details
  giftId: 5655,
  repeatCount: 1,
  repeatEnd: true,  
  describe: 'Sent Rose',
  giftType: 1,
  diamondCount: 1,
  giftName: 'Rose',
  giftPictureUrl: 'https://p19-webcast.tiktokcdn.com/...',
  timestamp: 1649962111957,
  extendedGiftInfo: {
    // This will be filled when you enable the `enableExtendedGiftInfo` option
  },
  
  // Receiver Details
  receiverUserId: '7044962356446839814'
}

roomUser

Triggered every time a statistic message arrives. This message currently contains only the viewer count.

tiktokChatConnection.on('roomUser', data => {
    console.log(`Viewer Count: ${data.viewerCount}`);
})

like

Triggered when a viewer sends likes to the streamer. For streams with many viewers, this event is not always triggered by TikTok.

tiktokChatConnection.on('like', data => {
    console.log(`${data.uniqueId} sent ${data.likeCount} likes, total likes: ${data.totalLikeCount}`);
})

Data structure:

{
  likeCount: 5, // likes given by the user (taps on screen)
  totalLikeCount: 83033, // likes that this stream has received in total
  userId: '6776663624629974121',
  uniqueId: 'zerodytester',
  nickname: 'Zerody One',
  profilePictureUrl: 'https://p16-sign-sg.tiktokcdn.com/...',
  displayType: 'pm_mt_msg_viewer',
  label: '{0:user} sent likes to the host'
}

social

Triggered every time someone shares the stream or follows the host.

tiktokChatConnection.on('social', data => {
    console.log('social event data:', data);
})

Data structure:

{
  userId: '6776663624629974121',
  uniqueId: 'zerodytester',
  nickname: 'Zerody One',
  profilePictureUrl: 'https://p16-sign-va.tiktokcdn.com/...',
  displayType: 'pm_main_follow_message_viewer_2', // or 'pm_mt_guidance_share' for sharing
  label: '{0:user} followed the host'
}

questionNew

Triggered every time someone asks a new question via the question feature.

tiktokChatConnection.on('questionNew', data => {
    console.log(`${data.uniqueId} asks ${data.questionText}`);
})

Data structure:

{
  questionText: 'Do you know why TikTok has such a complicated API?',
  userId: '6776663624629974121',
  uniqueId: 'zerodytester',
  nickname: 'Zerody One',
  profilePictureUrl: 'https://p16-sign-va.tiktokcdn.com/...'
}

linkMicBattle

Triggered every time a battle starts.

tiktokChatConnection.on('linkMicBattle', (data) => {
    console.log(`New Battle: ${data.battleUsers[0].uniqueId} VS ${data.battleUsers[1].uniqueId}`);
})

Data structure:

{
    battleUsers: [
        {
            userId: '6761609734837650437', // Host
            uniqueId: 'haje_bahjat',
            nickname: '𝙃𝙖𝙟𝙚_𝙗𝙖𝙝𝙟𝙖𝙩',
            profilePictureUrl: 'https://p77-sign-sg.tiktokcdn.com/...'
        },
        {
            userId: '6994367558246597637', // Guest
            uniqueId: 'aborayanelzidicomedy',
            nickname: 'ابو ريان الايزيدي الكوميدي',
            profilePictureUrl: 'https://p16-sign-va.tiktokcdn.com/....'
        }
    ]
}

linkMicArmies

Triggered every time a battle participant receives points. Contains the current status of the battle and the army that suported the group.

tiktokChatConnection.on('linkMicArmies', (data) => {
    console.log('linkMicArmies', data);
})

Data structure:

{
    "battleStatus": 1, // 1 = running; 2 = final state
    "battleArmies": [
        {
            "hostUserId": "6761609734837650437", // Streamer Host ID
            "points": 17058,
            "participants": [ // Top 3 supporters
                {
                    "userId": "6809941952760742917",
                    "nickname": "Abdulaziz Slivaney"
                },
                {
                    "userId": "7062835930043139078",
                    "nickname": "Dilschad Amedi"
                },
                {
                    "userId": "6773657511493977093",
                    "nickname": "Kahin Guli"
                }
            ]
        },
        {
            "hostUserId": "6994367558246597637", // Streamer Guest ID
            "points": 6585,
            "participants": [
                {
                    "userId": "7060878425477792773",
                    "nickname": "ADAM"
                },
                {
                    "userId": "7048005772659328006",
                    "nickname": "كلو"
                },
                {
                    "userId": "6818014975869699078",
                    "nickname": "Karwan###"
                }
            ]
        }
    ]
}

liveIntro

Triggered when a live intro message appears.

tiktokChatConnection.on('liveIntro', (msg) => {
    console.log(msg);
})

Examples

Retrieve Room Info

let tiktokChatConnection = new WebcastPushConnection('@username');

tiktokChatConnection.getRoomInfo().then(roomInfo => {
    console.log(roomInfo);
    console.log(`Stream started timestamp: ${roomInfo.create_time}, Streamer bio: ${roomInfo.owner.bio_description}`);
    console.log(`HLS URL: ${roomInfo.stream_url.hls_pull_url}`); // Can be played or recorded with e.g. VLC
}).catch(err => {
    console.error(err);
})

Retrieve Available Gifts

let tiktokChatConnection = new WebcastPushConnection('@username');

tiktokChatConnection.getAvailableGifts().then(giftList => {
    console.log(giftList);
    giftList.forEach(gift => {
        console.log(`id: ${gift.id}, name: ${gift.name}, cost: ${gift.diamond_count}`)
    });
}).catch(err => {
    console.error(err);
})

Send Chat Messages

You can send chat messages via the sendMessage() function to automatically respond to chat commands for example. For this you need to provide your Session ID.

To get the Session ID from your account, open TikTok in your web browser and make sure you are logged in, then press F12 to open the developer tools. Switch to the Application tab and select Cookies on the left side. Then take the value of the cookie with the name sessionid.

WARNING: Use of this function is at your own risk. Spamming messages can lead to the suspension of your TikTok account. Be careful!

let tiktokChatConnection = new WebcastPushConnection('@username', {
    sessionId: 'f7fbba3a57e48dd1ecd0b7b72cb27e6f' // Replace this with the Session ID of your TikTok account
});

tiktokChatConnection.connect().catch(err => console.log(err));

tiktokChatConnection.on('chat', data => {
    if (data.comment.toLowerCase() === '!dice') {
        let diceResult = Math.ceil(Math.random() * 6);
        tiktokChatConnection.sendMessage(`@${data.uniqueId} you rolled a ${diceResult}`).catch(err => console.error(err));
    }
})

Connect via Proxy

proxy-agent supports http, https, socks4 and socks5 proxies:

npm i proxy-agent

You can specify if you want to use a proxy for https requests, websockets or both:

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

let tiktokChatConnection = new WebcastPushConnection('@username', {
    requestOptions: {
        httpsAgent: new ProxyAgent('https://username:password@host:port'),
        timeout: 10000 // 10 seconds
    },
    websocketOptions: {
        agent: new ProxyAgent('https://username:password@host:port'),
        timeout: 10000 // 10 seconds
    }
});

// Connect as usual

Contributing

Your improvements are welcome! Feel free to open an issue or pull request.

Comments
  • Uncaught TypeError: Cannot read properties of undefined (reading 'gift_type')

    Uncaught TypeError: Cannot read properties of undefined (reading 'gift_type')

    Hello, what can it be? We use a simple code and sometimes it gives this error

    Uncaught TypeError: Cannot read properties of undefined (reading 'gift_type')

    if (data.gift.gift_type === 1 && data.gift.repeat_end === 0) {} else {

    opened by OlegShklyarov 34
  • Duplicate chat events

    Duplicate chat events

    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.

    opened by therebelrobot 18
  • The likeCount limited to 15 likes.

    The likeCount limited to 15 likes.

    Hi, I have an issue with the like likeCount. it only logs up to 15 likes. How can I make it so that it doesn't stop at 15? It shouldn't be displaying the likeCount before the user stops tapping the screen. It should only show the final likeCount amount after the user stops tapping. Hope you can help me out with this. Thank you in advance!

    opened by richjr93 15
  • WebcastLiveIntroMessage proto

    WebcastLiveIntroMessage proto

    Noticed the WebcastLiveIntroMessage is not implemented in the proto file.

    I'd create the proto myself but I'm not sure how you managed to RE the proto definitions.

    This is a base64 encoded example:

    CiMKF1dlYmNhc3RMaXZlSW50cm9NZXNzYWdlEIGWlPyS17qQYhCBlpT8kte6k
    GIYASJOUmVhbCBsaWZlIGh1bWFub2lkIHJvYm90LiBTZW5kIHlvdXIgcXVlc3Rpb25zIGFuZCBmbG93ZXJzIGZvciByZWFsIHJvYm90IEFsZXguKp0ECIGIgO6
    t6+64XxoIUHJvbW9ib3RKmQMKqgFodHRwczovL3AxNi1zaWduLXNnLnRpa3Rva2Nkbi5jb20vYXdlbWUvMTAweDEwMC90b3MtYWxpc2ctYXZ0LTAwNjgvMDNjZ
    jk4ZDc0MmUwNmI5YWI5MGY3NmE0OTM4ODZiMGIud2VicD94LWV4cGlyZXM9MTY0NjQwOTYwMCZ4LXNpZ25hdHVyZT1GdnpDQU1yRTZzekZ3THJLbFZ0MVUlMkJ
    EVDFHSSUzRAqsAWh0dHBzOi8vcDE2LXNpZ24tc2cudGlrdG9rY2RuLmNvbS9hd2VtZS8xMDB4MTAwL3Rvcy1hbGlzZy1hdnQtMDA2OC8wM2NmOThkNzQyZTA2Y
    jlhYjkwZjc2YTQ5Mzg4NmIwYi5qcGVnP3gtZXhwaXJlcz0xNjQ2NDA5NjAwJngtc2lnbmF0dXJlPUlHJTJGOW5IeGl0bCUyRmxGbTRoODREREd4eWN5R3clM0Q
    SOzEwMHgxMDAvdG9zLWFsaXNnLWF2dC0wMDY4LzAzY2Y5OGQ3NDJlMDZiOWFiOTBmNzZhNDkzODg2YjBisgEGCBwQoctiggIAsgIPcHJvbW9ib3Qucm9ib3Rz8
    gJMTVM0d0xqQUJBQUFBQzF5SXlyOGhSbkFkcG8xS2NaNTRpeXh1Sll2TTh4MUIwUWkxcmVuZ2VVT1FHTDJpak5ycUwxTk8wcEhaaW1aMToYCAKqARMIAhIPcG1
    fbXRfaG9zdGxhYmVs
    
    opened by Davincible 13
  • I can not see likes and followers

    I can not see likes and followers

    Hello! In Server.js I have added

            thisConnection.on('like', msg => socket.emit('like', msg));
            thisConnection.on('social', msg => socket.emit('social', msg));
    

    In public app I have this:

    socket.on('like', function(msg){
    console.log("like");
    console.log(msg.totalLikeCount);
    });
    
    socket.on('social', function(){
    console.log("follow");
    });
    

    And there are no alerts coming. Gifts and chat are working fine. What am I doing wrong?

    opened by OlegShklyarov 11
  • Chat messages works well

    Chat messages works well

    Hello i am from Ukraine and my english is bad and i faced with problem, when your stream watching few people it's ok to use this library and i can get every message from chat, but if my stream watching from 300 to 1.5k people and every body writing messages to chat, this TikTol-Live-Connector lib starts skipping chat messages, when i compare it with tiktok chat on my device it looks like messages come in batches and this tiktok live connector library just showing the last message, you know tiktok server sending like 5-10 messages same time and library only shows last one, please test this on very active stream and see what i am trying to describe! if you understand me please tell me what to do to fix it somehow, maybe i can get messages in some kind of array?

    opened by vladosnik 9
  • Treasure Box / WebcastEnvelopeMessage

    Treasure Box / WebcastEnvelopeMessage

    Hi!

    First I like to say thanks for your great work, it's very helpful for me right now!

    For the project I'm working on I need to receive infos, if someone gifted a treasure box, that everyone in the room can open and may receive some coins. This box is unfortunately not part of the gift list. Is there a way to retrieve infos about it?

    After scanning the raw Webcast I think, the WebcastEnvelopeMessage may contain the searched infos, but i'm too dumb to get the raw data decoded... 😕

    opened by dranthir 9
  • Override signature provider

    Override signature provider

    Since signing url are mandatory, to make it easier when you want to use external signature provider, we added a function to override the signing process.

    New config:

    let config = {
        enabled: true,
        signProvider: signProvider,
        signProviderHost: 'https://tiktok.isaackogan.com/',
        signProviderPath: 'webcast/sign_url',
        extraParams: {},
    };
    

    Test:

    const { WebcastPushConnection, signatureProvider } = require('tiktok-live-connector');
    const axios = require('axios').create({
        timeout: 5000
    });
    
    // Set custom signature provider before connect
    signatureProvider.config.signProvider = async function (url, headers, cookieJar, signEvents) {
        try {
            // Get signature from server
            let params = {
                url: url
            }
            let signResponse = await axios.get("https://your-sign-server/sign_url", { params, responseType: 'json' });
    
            // Set headers
            headers['User-Agent'] = signResponse.data['User-Agent'];
    
            // Set cookies
            cookieJar.setCookie('msToken', signResponse.data['msToken']);
    
            // Emit success event
            signEvents.emit('signSuccess', {
                originalUrl: url,
                signedUrl: signResponse.data.signedUrl,
                headers,
                cookieJar,
            });
    
            // Return signed url
            return signResponse.data.signedUrl;
    
        } catch (error) {
            // Emit error event
            signEvents.emit('signError', {
                originalUrl: url,
                headers,
                cookieJar,
                error,
            });
    
            throw new Error(`Failed to sign request: ${error.message}; URL: ${url}`);
        }
    }
    
    // Username of someone who is currently live
    let tiktokUsername = "officialgeilegisela";
    
    // Create a new wrapper object and pass the username
    let tiktokLiveConnection = new WebcastPushConnection(tiktokUsername);
    
    // Connect to the chat (await can be used as well)
    tiktokLiveConnection.connect().then(state => {
        console.info(`Connected to roomId ${state.roomId}`);
    }).catch(err => {
        console.error('Failed to connect', err);
    });
    
    opened by adierebel 7
  • Failed to retrieve room_id from page source. Request failed with status code 403

    Failed to retrieve room_id from page source. Request failed with status code 403

    I've been randomly getting this error for days now. It works for many hours, and then it just starts saying this and doesn't until the next day. Am I being rate limited or...?

    opened by ThanoFish 7
  • Events stopped after about 1-2 minutes

    Events stopped after about 1-2 minutes

    Hi, I'm running demo code from readme ( connect and read some events) But after of 1-2 minutes of running the script the events are stopped to be printing to console. After rerun script for a few times i have same problem. 1-3 minutes of events are printed and then stopped

    Also I had error events that unable to upgrade to websockets. After i set enableWebsocketUpgrade: false error is not appears but events still not printed, and the same for raw data

    opened by mostor-v 6
  • Get profile picture of user who isn't streaming.

    Get profile picture of user who isn't streaming.

    I wanted to get the info of any user even if they are not streaming. I found that the getRoomInfo method works great for this, but I can't find the url for the profile picture.

    opened by ThanoFish 6
  • Expo and React Native issue with 'events' library

    Expo and React Native issue with 'events' library

    Error:

    The package at "node_modules/tiktok-live-connector/dist/index.js" attempted to import the Node standard library module "events".
    It failed because the native React runtime does not include the Node standard library.
    

    To replicate:

    1. Create Expo project
    npx create-expo-app tiktok
    
    1. Install tiktok-live-connector
    npm i tiktok-live-connector
    
    1. Add first example line
    // imports...
    
    const { WebcastPushConnection } = require('tiktok-live-connector');
    
    export default function App() {
      return ...
    }
    
    1. Run Expo app
    npx expo start
    

    Attempts to fix:

    • Installing events with npm leads to a domino effect of issues. Next library missing is utils. Next is zlib. Then zlib breaks. Then deleted zlib and tried installing minizlib instead. Minizlib also breaks. Etc.
    opened by ericcherny 0
  • one setInterval() is causing node running forever.

    one setInterval() is causing node running forever.

    https://github.com/zerodytrash/TikTok-Live-Connector/blob/be0ed04b5ec20a0b401f488382390256c718ef5f/src/lib/tiktokUtils.js#L37

    I used tool "why-is-node-running" to figure out why my code won't exit after almost an hour.

    I think this code maybe is for statsical need on signServer. But using this way to track tiktok id usage will result node running forever even there is no other event need node to run.

    Maybe you can try add timestamp to each uu element then do the check for 30mins old uu every time before sending uu to signServer. So you don't need to check in setInternal.

    enhancement 
    opened by Cojad 1
  • Unable to use with proxy [Got 403 status]

    Unable to use with proxy [Got 403 status]

    I try to create new connections with my proxy provider but it always returns 403 HTTP status. I'm not sure has anyone caused the same problem with me? (I use the proxy from proxy-cheap.com) Has anyone used this with a proxy please share how you use it?

    opened by alphafast 1
Releases(v1.0.2)
  • v1.0.2(Oct 22, 2022)

  • v1.0.1(Sep 15, 2022)

    • Fix CookieJar process set cookie when value has = by @nealnote (https://github.com/zerodytrash/TikTok-Live-Connector/pull/62)
    • Fix Already connected! error if the previous connection attempt failed. (https://github.com/zerodytrash/TikTok-Live-Connector/commit/bcaca692b9d9a478afd775e852d061076018e8aa)
    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(Aug 30, 2022)

    • Add gzip compression WebSocket support https://github.com/zerodytrash/TikTok-Live-Connector/commit/c4c30b36ecbee676a42d951c5109c0fb9410d429
    • Trigger streamEnd on user ban https://github.com/zerodytrash/TikTok-Live-Connector/commit/7c364e6e590a5d280b7f257b74f413a3292afa85
    • Add decodedData event (for debugging) https://github.com/zerodytrash/TikTok-Live-Connector/commit/7c364e6e590a5d280b7f257b74f413a3292afa85
    • Improve WebSocket timeout handling https://github.com/zerodytrash/TikTok-Live-Connector/commit/184b783c893779195f75884c48bdee942c384b70
    • Add enableRequestPolling option https://github.com/zerodytrash/TikTok-Live-Connector/commit/184b783c893779195f75884c48bdee942c384b70
    • Add timestamp and messageId fields, Add new proto definitions https://github.com/zerodytrash/TikTok-Live-Connector/commit/dca5368ebb45a3bc979f97a1a1567d58cf486f26 by @carcabot
    • Add new fields for User (like FollowInfo) https://github.com/zerodytrash/TikTok-Live-Connector/commit/feb498b3a82b3896b4513873cdac5bae35fd676c by @carcabot
    • Add profilePictureUrls (array) to userDetails #54 https://github.com/zerodytrash/TikTok-Live-Connector/commit/1355505a99d5828865745d6b3a423529f4783eaa
    • Choose preferred profile picture format automatically https://github.com/zerodytrash/TikTok-Live-Connector/commit/2313d27811184b9242333b49e2be3a995198a93e
    • Add WebcastSubNotifyMessage (subscribe event) https://github.com/zerodytrash/TikTok-Live-Connector/commit/03bcd6605baa8df6d8dd87c040a53e0946691120
    • Fix isSubscriber flag https://github.com/zerodytrash/TikTok-Live-Connector/commit/25752a9cb25ebe2b14209e487aa7e95ce4a8d6d2
    • Split social event in follow and share https://github.com/zerodytrash/TikTok-Live-Connector/commit/b788e7f6d18cdc2b6834830b5e4efb2d9d0b88e0
    • Add TypeScript declarations #53 https://github.com/zerodytrash/TikTok-Live-Connector/commit/998ba038d3b90799a5e3a29a2132fe66cbd26ef5

    Update via npm i [email protected]

    Source code(tar.gz)
    Source code(zip)
  • v0.9.23(Jul 24, 2022)

    • Fix connection to TikTok due to breaking changes on the part of TikTok.

    Run npm update to upgrade to the latest version. Older versions are no longer working.

    Source code(tar.gz)
    Source code(zip)
  • v0.9.22(Jun 30, 2022)

    • Add subscribe event (https://github.com/zerodytrash/TikTok-Live-Connector/commit/31454c2d3f91c82478ce2a2a18ed8b87eab7e5d4)
    • Update Webcast params (https://github.com/zerodytrash/TikTok-Live-Connector/commit/31e95c19393e79d63184ae8b75453b211e7f833c)
    Source code(tar.gz)
    Source code(zip)
  • v0.9.21(Jun 11, 2022)

    • Fix userBadges #32
    • Add envelope (treasure chest) event #27 (doc)
    • Add emote (subscription sticker) event (doc)
    • Add user attributes (to all user related events):
      • isSubscriber (bool)
      • isModerator (bool)
      • isNewGifter (bool)
      • topGifterRank (number)
    • Update protobufjs to 6.11.3
    Source code(tar.gz)
    Source code(zip)
  • v0.9.20(Apr 14, 2022)

Owner
David
Developer & Web Security Researcher ~ Discord: ZerodyOne#4779 ~ hackerone.com/zerody ❤'">
David
SpaceChat - a realtime chat app that allows you to chat with your friends in pairs as well as in groups

A socket.io based real time chat app where you can perform one-to-one chats as well as group chats! Built using MERN stack, this project implements all core functionalities like User Authentication, Web Sockets, CRUD Operations, Routing and much more!

Ishant Chauhan 11 Aug 1, 2022
Simple realtime chat application made by NodeJS, Express, Socket.io and Vanilla Javascript. This project is made to discover socket.io and understand its basic features.

LearnByChat App Simple realtime chat application made with NodeJS, Express, Socket.io and Vanilla Javascript. This project is made to discover socket.

Ayoub Saouidi 1 Dec 19, 2021
Chotu Chat Room is a minimal, distraction-free chat application

Chotu Chat Room is a minimal, distraction-free chat application. We have some predefined channels that anyone can join. No registration/login required.

Chotu Projects 8 Sep 19, 2022
Sse-example - SSE (server-sent events) example using Node.js

sse-example SSE (server-sent events) example using Node.js SSE is a easy way to commutate with the client side in a single direction. it has loss cost

Jack 2 Mar 11, 2022
Mini Projeto de um chat-app usando o protocolo WebSocket através da lib 'ws' do node.js

CHAT-APP-WEBSOCKET Mini Projeto de um chat-app usando o protocolo WebSocket através da lib 'ws' do node.js Obs o intuito deste projeto não é o fronten

Vinicius dos Santos Rodrigues 4 Jul 14, 2022
simple chat app created with nextjs, express, tailwindcss, and WebSockets

This is a Next.js project bootstrapped with create-next-app. Getting Started First, run the development server: npm run dev # or yarn dev Open http://

Erfan Hanifezade 10 Sep 10, 2022
Create a Real-time Chat App using React and Socket.io

React And Socket.io ChatApp MIT Licence MIT License Copyright (c) 2021 Ali Ahmad Permission is hereby granted, free of charge, to any person obtaining

Ali Ahmad 2 Jan 10, 2022
A simple web app that people can chat and send images into.

Typsnd Typsnd. Type, send. It's as simple as that. Typsnd is a simple web app that people can chat and send images into. It is based on Express.JS, No

null 10 Nov 10, 2022
This server is made to serve the MSN-Messenger app develop by Gabriel Godoy. This applications is capable to register users and messages in order implements a real time chat.

?? MSN-Messenger-Server Node.js server for real time chat About | Installations | How to Use | Documentation | Technologies | License ?? About This se

Guilherme Feitosa 7 Dec 20, 2022
How to build a chat using Lambda + WebSocket + API Gateway? (nodejs)

Description Source code for the lambda function from the screencast How to build a chat using Lambda + WebSocket + API Gateway? (nodejs) The reactjs c

Alex 21 Dec 28, 2022
Chat with your gpg contacts without leaving the terminal

chatty GPG encrypted, ephemeral, real time chatting in the terminal Features End to end encrypted Passwordless Real time vim like keybindings Requirem

Navdeep Saini 33 Jun 7, 2022
video-chat-app Fully functional one-to-one video calling feature.

video-chat-app Fully functional one-to-one video calling feature.

suraj ✨ 7 Oct 10, 2022
Lightweight WebSocket lib with socket.io-like event handling, requests, and channels

ws-wrapper Lightweight and isomorphic Web Socket lib with socket.io-like event handling, Promise-based requests, and channels. What? Much like Socket.

Blake Miner 70 Dec 23, 2022
This Repository implements an Authenticated Websocket Server built in Node Js along ws library.

websockets-authentication-server This Repository implements an Authenticated Websocket Server built in Node Js along ws library. Features Authenticate

M.Abdullah Ch 7 May 5, 2023
Simple to use, blazing fast and thoroughly tested WebSocket client and server for Node.js

ws: a Node.js WebSocket library ws is a simple to use, blazing fast, and thoroughly tested WebSocket client and server implementation. Passes the quit

WebSockets 19.2k Jan 4, 2023
A node.js module for websocket server and client

Nodejs Websocket A nodejs module for websocket server and client How to use it Install with npm install nodejs-websocket or put all files in a folder

Guilherme Souza 719 Dec 13, 2022
JSON-RPC 2.0 implementation over WebSockets for Node.js and JavaScript/TypeScript

WebSockets for Node.js and JavaScript/TypeScript with JSON RPC 2.0 support on top. About The rpc-websockets library enables developers to easily imple

Elpheria 482 Dec 21, 2022
A WebSocket Implementation for Node.JS (Draft -08 through the final RFC 6455)

WebSocket Client & Server Implementation for Node Overview This is a (mostly) pure JavaScript implementation of the WebSocket protocol versions 8 and

Brian McKelvey 3.6k Dec 30, 2022
WebSocket emulation - Node.js server

SockJS-node SockJS for enterprise Available as part of the Tidelift Subscription. The maintainers of SockJS and thousands of other packages are workin

SockJS 2.1k Dec 29, 2022