Websocket client responsible for connections to TikTok
Signature
Section titled “Signature”class WebcastWSClient
WebcastWSClient( ws_kwargs: Optional[dict] = None, ws_proxy: Optional[WebcastProxy] = None,)Initialize WebcastWSClient
Parameters
Section titled “Parameters”ws_kwargs(Optional[dict], defaultNone) — Overrides for the websocket connectionws_proxy(Optional[WebcastProxy], defaultNone)
Attributes
Section titled “Attributes”DEFAULT_PING_INTERVAL(float) =5.0ws(property,Optional[WebSocketClientProtocol]) — Get the current WebSocketClientProtocolconnected(property,bool) — Check if the WebSocket is open
Methods
Section titled “Methods”send()— Send a message to the WebSocketsend_ack()— Acknowledge the receipt of a ProtoMessageFetchResult message from TikTok, if necessarydisconnect()— Request to stop the websocket connection & waitget_ws_cookie_string()— Get the cookie string for the WebSocket connection.connect()— Connect to the Webcast server & iterate over response messages.restart_ping_loop()— Restart the WebSocket ping loopswitch_rooms()
Import
Section titled “Import”from TikTokLive.client.ws.ws_client import WebcastWSClient