connection

package
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2026 License: 0BSD Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildWSSURL

func BuildWSSURL(cdnHost string, roomID string, timezone string, language string, region string) string

BuildWSSURL constructs the TikTok Live WebSocket URL for a given room. The timezone parameter should be an IANA timezone name (e.g. "Europe/London").

func DecompressIfGzipped added in v0.1.4

func DecompressIfGzipped(data []byte) ([]byte, error)

DecompressIfGzipped checks for gzip magic bytes and decompresses if present.

func RunWebSocket

func RunWebSocket(ctx context.Context, wssURL string, cookieHeader string, userAgent string, roomID string, staleTimeout time.Duration, acceptLanguage string, proxy string, eventCh chan<- events.Event) error

RunWebSocket connects to the TikTok Live WSS endpoint and streams events. The userAgent parameter sets the User-Agent header for the WSS handshake. The cookieHeader is the full Cookie header value (e.g. "ttwid=xxx; sessionid=yyy"). Pass acceptLanguage for locale-aware header (e.g. "ro-RO,ro;q=0.9"). Empty = auto-detect. Pass proxy URL for HTTP CONNECT tunneling; empty falls back to env vars.

Types

type DeviceBlockedError

type DeviceBlockedError struct{}

DeviceBlockedError is returned when the WSS handshake responds with Handshake-Msg: DEVICE_BLOCKED, meaning the ttwid was flagged.

func (*DeviceBlockedError) Error

func (e *DeviceBlockedError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL