TikTokLiveConnection
Defined in: src/lib/client/index.ts:43
Extends
Section titled “Extends”TypedEventEmitter<ClientEventMap,this>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new TikTokLiveConnection(
uniqueId,options?):TikTokLiveConnection
Defined in: src/lib/client/index.ts:76
Create a new TikTokLiveConnection instance.
Parameters
Section titled “Parameters”uniqueId
Section titled “uniqueId”string
TikTok username (with or without leading @, or a full https://www.tiktok.com/@user/live URL).
options?
Section titled “options?”Partial<object & object & object> & object & object | Partial<object & object & object> & object & object | Partial<object & object & object> & object & object | never | Partial<object & object & object> & object & object | Partial<object & object & object> & object & object | never | Partial<object & object & object> & object & object | Partial<object & object & object> & object & object = {}
Optional connection options.
Partial<object & object & object> & object & object
Partial<object & object & object> & object & object
Partial<object & object & object> & object & object
never
Partial<object & object & object> & object & object
Partial<object & object & object> & object & object
never
Partial<object & object & object> & object & object
Partial<object & object & object> & object & object
Returns
Section titled “Returns”TikTokLiveConnection
Overrides
Section titled “Overrides”(EventEmitter as WebcastTypedClient).constructor
Properties
Section titled “Properties”options
Section titled “options”
readonlyoptions:TikTokLiveConnectionMutableOptions
Defined in: src/lib/client/index.ts:46
uniqueId
Section titled “uniqueId”
readonlyuniqueId:string
Defined in: src/lib/client/index.ts:77
TikTok username (with or without leading @, or a full https://www.tiktok.com/@user/live URL).
Accessors
Section titled “Accessors”apiClient
Section titled “apiClient”Get Signature
Section titled “Get Signature”get apiClient():
EulerStreamApiClient
Defined in: src/lib/client/index.ts:145
Get an instance of the underlying API Client
Returns
Section titled “Returns”EulerStreamApiClient
availableGifts
Section titled “availableGifts”Get Signature
Section titled “Get Signature”get availableGifts():
any
Defined in: src/lib/client/index.ts:181
Get the available gifts
Returns
Section titled “Returns”any
clientParams
Section titled “clientParams”Get Signature
Section titled “Get Signature”get clientParams():
Record<string,string>
Defined in: src/lib/client/index.ts:202
Get the current client parameters
Returns
Section titled “Returns”Record<string, string>
isConnected
Section titled “isConnected”Get Signature
Section titled “Get Signature”get isConnected():
boolean
Defined in: src/lib/client/index.ts:195
Check if the connection is established
Returns
Section titled “Returns”boolean
isConnecting
Section titled “isConnecting”Get Signature
Section titled “Get Signature”get isConnecting():
boolean
Defined in: src/lib/client/index.ts:188
Get the current connection state
Returns
Section titled “Returns”boolean
roomId
Section titled “roomId”Get Signature
Section titled “Get Signature”get roomId():
string
Defined in: src/lib/client/index.ts:209
Get the current room ID
Returns
Section titled “Returns”string
roomInfo
Section titled “roomInfo”Get Signature
Section titled “Get Signature”get roomInfo():
any
Defined in: src/lib/client/index.ts:174
Get the current Room Info
Returns
Section titled “Returns”any
Get Signature
Section titled “Get Signature”get state():
TikTokLiveConnectionState
Defined in: src/lib/client/index.ts:218
Get the current connection state including the cached room info and all available gifts
(if enableExtendedGiftInfo option enabled)
Returns
Section titled “Returns”webClient
Section titled “webClient”Get Signature
Section titled “Get Signature”get webClient():
WebcastHttpClient
Defined in: src/lib/client/index.ts:138
Get the current Web Client instance
Returns
Section titled “Returns”wsClient
Section titled “wsClient”Get Signature
Section titled “Get Signature”get wsClient():
WebcastWebSocketClient|null
Defined in: src/lib/client/index.ts:152
Get the current WebSocket client instance. Will be null if not connected.
Returns
Section titled “Returns”WebcastWebSocketClient | null
Methods
Section titled “Methods”connect()
Section titled “connect()”connect(
roomId?):Promise<TikTokLiveConnectionState>
Defined in: src/lib/client/index.ts:234
Connects to the live stream of the specified streamer
Parameters
Section titled “Parameters”roomId?
Section titled “roomId?”string
Room ID to connect to. If not specified, the room ID will be retrieved from the TikTok API
Returns
Section titled “Returns”Promise<TikTokLiveConnectionState>
The current connection state
disconnect()
Section titled “disconnect()”disconnect():
Promise<void>
Defined in: src/lib/client/index.ts:369
Disconnects the connection to the live stream
Returns
Section titled “Returns”Promise<void>
fetchAvailableGifts()
Section titled “fetchAvailableGifts()”fetchAvailableGifts():
Promise<any>
Defined in: src/lib/client/index.ts:440
Get the available gifts in the current room
Returns
Section titled “Returns”Promise<any>
Promise that will be resolved when the available gifts have been retrieved from the API
fetchIsLive()
Section titled “fetchIsLive()”fetchIsLive(
uniqueId?):Promise<boolean>
Defined in: src/lib/client/index.ts:410
Fetch whether the streamer is currently live
Parameters
Section titled “Parameters”uniqueId?
Section titled “uniqueId?”string = ...
Returns
Section titled “Returns”Promise<boolean>
fetchRoomId()
Section titled “fetchRoomId()”fetchRoomId(
uniqueId?):Promise<string>
Defined in: src/lib/client/index.ts:395
Fetch the room ID from the TikTok API
Parameters
Section titled “Parameters”uniqueId?
Section titled “uniqueId?”string = ...
Optional unique ID to use instead of the current one
Returns
Section titled “Returns”Promise<string>
fetchRoomInfo()
Section titled “fetchRoomInfo()”fetchRoomInfo(
roomId?):Promise<any>
Defined in: src/lib/client/index.ts:425
Get the current room info (including streamer info, room status and statistics)
Parameters
Section titled “Parameters”roomId?
Section titled “roomId?”string = ...
Returns
Section titled “Returns”Promise<any>
Promise that will be resolved when the room info has been retrieved from the API
sendMessage()
Section titled “sendMessage()”sendMessage(
content,roomId?):Promise<WebcastRoomChatRouteResponse>
Defined in: src/lib/client/index.ts:456
Send a message to a TikTok LIVE Room
Parameters
Section titled “Parameters”content
Section titled “content”string
Message content to send to the stream
roomId?
Section titled “roomId?”string = ...
Target room ID. If not specified, the message will be sent to the currently connected room. Note that a room ID is required to send a message, so if you’re not currently connected to a room you must specify a room ID.
Returns
Section titled “Returns”Promise<WebcastRoomChatRouteResponse>
waitUntilLive()
Section titled “waitUntilLive()”waitUntilLive(
seconds?,abortSignal?):Promise<void>
Defined in: src/lib/client/index.ts:708
Wait until the streamer is live
Parameters
Section titled “Parameters”seconds?
Section titled “seconds?”number = 60
Number of seconds to wait before checking if the streamer is live again
abortSignal?
Section titled “abortSignal?”AbortSignal
Process will keep checking if the streamer is live every seconds seconds until the streamer is live or the abort signal is triggered
Returns
Section titled “Returns”Promise<void>