Hey, I am experiencing a critical inconsistency be...
# ask-ai
c
Hey, I am experiencing a critical inconsistency between client-side logs and LiveKit dashboard when streaming from GStreamer to LiveKit via WHIP protocol. INCONSISTENCY BETWEEN CLIENT AND SERVER From Client Side (GStreamer logs): • ✅ WHIP handshake successful (HTTP 201 Created) • ✅ ICE connection state: "connected" • ✅ Peer connection state: "connected" • ✅ Media streaming working normally From LiveKit Dashboard: • ❌ Shows error: "could not establish signal connection" • ❌ Connection reported as failed System Configuration • Protocol: WHIP • LiveKit Endpoint:
https://[project_url]/w/stream_key
• Stream Key: • Media Format: ◦ Video: H.264, 1280x720@10fps, constrained-baseline profile ◦ Audio: Opus, 48kHz mono • GStreamer Pipeline:
whipclientsink
with LiveKit endpoint Additional Information • Issue occurs consistently - client always reports connected but dashboard always shows error • Same stream key and endpoint used • Network connection is stable How can we debug the "signal connection" in more detail from LiveKit server side? Do you have any ideas?
t
Thanks for reaching out, Phong. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
c
# Important Log Lines ## SUCCESS CASE LOG (feeder-grpc_2025-08-26_01-00-13-livekit-whip-success.log) ### 1. GStreamer Pipeline Execution
Copy code
Line 33: 2025/08/26 01:00:57 :clapper: Executing GStreamer command: gst-launch-1.0 -v whipclientsink name=whip signaller::whip-endpoint=https://linkbal-webrtc-test-202506-po4gvtpa.whip.livekit.cloud/w/pbrtSvfzd9 audio-caps=audio/x-opus video-caps=video/x-h264 fdsrc fd=3 blocksize=1920 ! queue ! rawaudioparse use-sink-caps=false format=pcm pcm-format=s16le sample-rate=48000 num-channels=1 ! audio/x-raw,rate=48000,channels=1,layout=interleaved ! audioconvert ! audioresample ! queue ! whip.audio_0 fdsrc fd=4 blocksize=1382400 ! queue ! rawvideoparse format=i420 width=1280 height=720 framerate=10/1 ! videorate max-rate=10 ! videoconvert ! x264enc tune=zerolatency speed-preset=ultrafast key-int-max=60 ! h264parse ! video/x-h264,stream-format=avc,alignment=au ! queue ! whip.video_0

Line 34: 2025/08/26 01:00:57 :white_check_mark: GStreamer pipeline started successfully (PID: 18)
### 2. WHIP Offer Sent
Copy code
Line 187: 0:00:01.462779751 DEBUG webrtc-whip-signaller Sending offer SDP: Ok("v=0\r\no=- 7506305671142243389 0 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\na=ice-options:trickle\r\na=group:BUNDLE video0 audio1\r\nm=video 9 UDP/TLS/RTP/SAVPF 96 98 99 100 101...")

Line 188: 0:00:01.487232376 DEBUG webrtc-whip-signaller Using endpoint https://linkbal-webrtc-test-202506-po4gvtpa.whip.livekit.cloud/w/pbrtSvfzd9
### 3. LiveKit Response (SUCCESS)
Copy code
Line 201: 0:00:04.223752419 DEBUG webrtc-whip-signaller Parsing endpoint response
Line 202: 0:00:04.223781836 DEBUG response status: 201 Created
Line 203: 0:00:04.223789294 DEBUG WHIP resource: "/w/pbrtSvfzd9SS/WH_xeUahd6JdJVr"
### 4. ICE Connection Established
Copy code
Line 425: 0:00:04.437468044 DEBUG webrtcnicetransport 1 1 connected
Line 426: 0:00:04.437837336 INFO ICE connection state change from checking(1) to connected(2)
### 5. Peer Connection Established
Copy code
Line 432: 0:00:04.448770419 INFO Peer connection state change from connecting(1) to connected(2)
### 6. Media Streaming Active
Copy code
Line 441: 0:00:04.455224461 INFO session 0 ssrc 525047068 new sender ssrc
Line 481: 0:00:04.621398461 DEBUG getting pt map for pt 97 in session 0
Line 482: 0:00:04.621421294 DEBUG Found caps application/x-rtp, media=(string)audio, payload=(int)97, clock-rate=(int)48000, encoding-name=(string)OPUS, sprop-stereo=(string)0, encoding-params=(string)2, sprop-maxcapturerate=(string)48000 for pt 97 in session 0
--- ## FAILED CASE LOG (feeder-grpc_2025-08-26_01-11-39-livekit-whip-failed.log) ### 1. GStreamer Pipeline Execution (IDENTICAL)
Copy code
Line 32: 2025/08/26 01:11:47 :clapper: Executing GStreamer command: gst-launch-1.0 -v whipclientsink name=whip signaller::whip-endpoint=https://linkbal-webrtc-test-202506-po4gvtpa.whip.livekit.cloud/w/pbrtSvfzd9 audio-caps=audio/x-opus video-caps=video/x-h264 [same pipeline]

Line 33: 2025/08/26 01:11:47 :white_check_mark: GStreamer pipeline started successfully (PID: 19)
### 2. WHIP Offer Sent (IDENTICAL)
Copy code
Line 201: 0:00:01.480907001 DEBUG webrtc-whip-signaller Sending offer SDP: Ok("v=0\r\no=- 4589976753644177838 0 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\na=ice-options:trickle\r\na=group:BUNDLE audio0 video1...")

Line 202: 0:00:01.494673126 DEBUG webrtc-whip-signaller Using endpoint https://linkbal-webrtc-test-202506-po4gvtpa.whip.livekit.cloud/w/pbrtSvfzd9
### 3. LiveKit Response (ALSO SUCCESS!)
Copy code
Line 214: 0:00:04.043459794 DEBUG webrtc-whip-signaller Parsing endpoint response
Line 215: 0:00:04.043492877 DEBUG response status: 201 Created
Line 216: 0:00:04.043511335 DEBUG WHIP resource: "/w/pbrtSvfzd9SS/WH_kkCUW2hNxB9g"
### 4. ICE Connection Established (IDENTICAL)
Copy code
Line 470: 0:00:04.305729002 DEBUG webrtcnicetransport 1 1 connected
Line 471: 0:00:04.306065585 INFO ICE connection state change from checking(1) to connected(2)
### 5. Peer Connection Established (IDENTICAL)
Copy code
Line 477: 0:00:04.317165294 INFO Peer connection state change from connecting(1) to connected(2)
### 6. Media Streaming Active (IDENTICAL)
Copy code
Line 372: 0:00:04.054912794 INFO session 0 ssrc 2372964231 new sender ssrc
Line 466: 0:00:04.262537752 DEBUG getting pt map for pt 97 in session 0
Line 467: 0:00:04.262553085 DEBUG Found caps application/x-rtp, media=(string)audio, payload=(int)97, clock-rate=(int)48000, encoding-name=(string)OPUS, encoding-params=(string)2, sprop-stereo=(string)0, sprop-maxcapturerate=(string)48000 for pt 97 in session 0
Line 498: 0:00:04.323364419 INFO session 0 ssrc 2561932233 new sender ssrc (video)
--- ## KEY OBSERVATION ***BOTH LOGS SHOW IDENTICAL SUCCESS PATTERNS:* - ✅ HTTP 201 Created response from LiveKit - ✅ WHIP resource allocated successfully - ✅ ICE connection established - ✅ Peer connection established - ✅ Media streaming active (both audio and video) ***YET DASHBOARD SHOWS:* "could not establish signal connection"
t
Let's troubleshoot the signal connection issue between GStreamer and LiveKit using the WHIP protocol together. Here are some friendly steps to guide you: 1. Verify GStreamer Configuration: Double-check that your GStreamer pipeline has the right plugins (
nicesink
,
webrtcbin
, and
whipsink
) set up. You can use the
gst-inspect-1.0
command to make sure they're all there. By the way, LiveKit offers a Docker image that already includes all the plugins you need, which might make things easier. 2. Run Connection Tests: Try out LiveKit's Connection Test tool to see how your WebSocket, WebRTC, and TURN server connections are doing. This can help spot any network or firewall hiccups. 3. Check LiveKit Ingress Configuration: Take a moment to verify that the
whip_base_url
in your LiveKit server setup points to the right external IP or load balancer. Also, make sure your Ingress service is correctly set up to chat smoothly with the LiveKit server. 4. Enable Debug Logging: If you want more insight, set the
log_level
to
debug
in your LiveKit Ingress config file. This will give you detailed logs about what's happening during the connection process. If you want me to walk you through any of these steps or if you have more questions, just let me know—I’m here to help! Sources: pkg/media/whip/whipsrc.go | Encoder configuration | LiveKit Docs | Diagnosing Connection Errors with Connection Test Utility
c
> Verify GStreamer Configuration: I've done this step, GStreamer has full plugin next step 2, how can i do this in details? > Run Connection Tests: Try out LiveKit's Connection Test tool to see how your WebSocket, WebRTC, and TURN server connections are doing. This can help spot any network or firewall hiccups.
t
Hey there! To help you run the LiveKit Connection Test and check WebSocket, WebRTC, and TURN server connectivity, here’s a simple guide you can follow: 1. Try the Standalone Web Tool: Just head over to https://livekit.io/connection-test. Pop in your LiveKit URL and a valid Room Token, then hit "Start Test". The tool will take care of checking WebSocket, WebRTC, and TURN connectivity for you. 2. Or, use the Client SDK if you like coding: Here’s some JavaScript you can use to test programmatically:
Copy code
import { ConnectionCheck } from '@livekit/client-sdk';

const checker = new ConnectionCheck({
  url: 'your-livekit-project-url',
  token: 'your-room-token'
});

const websocketResult = await checker.checkWebsocket();
const webrtcResult = await checker.checkWebRTC();
const turnResult = await checker.checkTURN();

if (websocketResult.status === 'FAILED' &&
    webrtcResult.status === 'FAILED' &&
    turnResult.status === 'FAILED') {
  console.log('Looks like there might be a firewall or VPN blocking things');
}
3. Don’t forget about Firewall Requirements: Make sure your network lets through these connections: ◦
*.livekit.cloud
on TCP:443 for WebSocket signaling ◦
*.turn.livekit.cloud
on TCP:443 for TURN/TLS ◦ UDP ports 50000–60000 for direct WebRTC media ◦ UDP:3478 for TURN/UDP relays If you get stuck or have any questions while running these tests, just give me a shout—I’m here to help! Sources: Configuring firewalls | LiveKit Docs | Configuring firewalls | LiveKit Docs | Firewall Tips | LiveKit Connection Tester | Diagnosing Connection Errors with Connection Test Utility
c
how can i get room token to test in https://livekit.io/connection-test
t
Hey there! To generate a room token for testing over at https://livekit.io/connection-test, here’s a simple step-by-step guide: 1. Using the LiveKit CLI: Just run this command to create your token:
Copy code
lk token create \
    --api-key <project_key> --api-secret <project_secret> \
    --join --room test_room --identity test_user \
    --valid-for 24h
Make sure to swap out
<project_key>
and
<project_secret>
with your actual LiveKit API credentials. This will give you a token that’s good for 24 hours for the room
test_room
. 2. If You’re in Development Mode: Running LiveKit with
livekit-server --dev
? No worries! You can use these default credentials:Here’s what the command looks like:
Copy code
lk token create \
    --api-key devkey --api-secret secret \
    --join --room my-first-room --identity user1 \
    --valid-for 24h
◦ API Key:
devkey
◦ API Secret:
secret
1. Or, Generate Tokens Programmatically: If you prefer, you can create tokens from your backend. For example, in Node.js:
Copy code
import { AccessToken } from 'livekit-server-sdk';

const at = new AccessToken('my-key', 'my-secret', {
  identity: 'test_user',
  ttl: '10m',
});
at.addGrant({
  roomJoin: true,
  room: 'test_room',
});
const token = at.toJwt();
Once you’ve got your token, just pop it in with your LiveKit URL on the connection test tool. And hey, if you hit any snags or have questions, I’m here to help! Sources: README.md | TEMPLATE.md | Swift quickstart | LiveKit Docs | CLI Setup | LiveKit Docs
c
Copy code
Connecting to signal connection via WebSocket
Error: Encountered unknown websocket error during connection: [object Event]

Establishing WebRTC connection
udp [2603:c024:8006:b800:0:6124:cbdf:47bc]:50001 host

udp 143.223.94.89:50001 host

tcp 143.223.94.89:7881 host (passive)

tcp [2603:c024:8006:b800:0:6124:cbdf:47bc]:7881 host (passive)

udp [2603:c024:8006:b800:0:6124:cbdf:47bc]:50002 host

udp 143.223.94.89:50002 host

tcp 143.223.94.89:7881 host (passive)

tcp [2603:c024:8006:b800:0:6124:cbdf:47bc]:7881 host (passive)

Warning: error with ICE candidate: 701 STUN host lookup received error. stun:ip-143-223-94-89.host.livekit.cloud:3478

Warning: error with ICE candidate: 701 TURN host lookup received error. turn:ip-143-223-94-89.host.livekit.cloud:3478?transport=udp

Warning: error with ICE candidate: 701 Address not associated with the desired network interface. turns:linkbal-webrtc-test-202506-po4gvtpa.turn.livekit.cloud:443?transport=tcp

Can connect via TURN
Error: Encountered unknown websocket error during connection: [object Event]

Can publish audio
Error: unable to detect audio from microphone

Can publish video
Error: could not establish signal connection: Encountered unknown websocket error during connection: [object Event]

Resuming connection after interruption
t
It looks like the errors in your connection test are pointing to some possible hiccups with WebSocket connectivity and ICE candidate resolution. Don’t worry, I’ve got some steps that can help you sort them out: 1. WebSocket Errors: First, double-check that your signaling URL starts with
wss://
and that it’s reachable. Make sure your token is valid and has the right permissions. If your server is behind a proxy or load balancer, just confirm that it supports WebSocket upgrades. 2. ICE Candidate Issues: These errors usually mean there might be some trouble with your STUN/TURN server setup or network restrictions. Here’s what to check: ◦ Are your TURN/STUN servers accessible and configured correctly? ◦ Is UDP and TCP traffic to LiveKit domains and ports allowed through your network? ◦ Is ICE/TCP enabled on your server, especially if UDP is blocked in your environment? 1. Firewall and Network Configuration: Make sure your firewall lets traffic through for: ◦
*.livekit.cloud
on TCP:443 for WebSocket signaling ◦
*.turn.livekit.cloud
on TCP:443 for TURN/TLS ◦ UDP ports 50000–60000 for direct WebRTC media ◦ UDP port 3478 for TURN/UDP relays 1. Run Connection Tests: You can use the
ConnectionCheck
class from the LiveKit SDK to test WebSocket, WebRTC, and TURN connectivity programmatically. Here’s a quick example:
Copy code
import { ConnectionCheck } from '@livekit/client-sdk';

const checker = new ConnectionCheck({ url: 'your-url', token: 'your-token' });
const websocketResult = await checker.checkWebsocket();
const webrtcResult = await checker.checkWebRTC();
const turnResult = await checker.checkTURN();
If you want, I’m here to help you walk through these steps or troubleshoot any other issues that pop up. Just let me know! Sources: solutions/doorbell_local/main/webrtc_test.html | Diagnosing Connection Errors with Connection Test Utility | src/api/SignalClient.ts