steep-balloon-41261
07/19/2023, 7:30 AMquiet-parrot-71005
07/19/2023, 7:53 AMTwirpRPC.js calling Axios for a wss request inside folder livekit-server-sdk > dist
TwirpRPC is being called in EgressClient.js as assigned to this.rpc which processes the startTrackEgress function.
And unless I've totally lost it, Axios isn't a websocket client.magnificent-art-43333
07/19/2023, 2:49 PMdry-elephant-14928
07/19/2023, 8:10 PMdry-elephant-14928
07/19/2023, 8:11 PMquiet-parrot-71005
07/20/2023, 4:08 AMegress_started event begins followed quickly by egress_ended with error field error: 'URL was not provided',
Here is my function:
async function livekitWebhook(req) {
const apiKey = process.env.LIVEKIT_API;
const secret = process.env.LIVEKIT_SECRET;
const webhook = "https://<our-websocket-url>.<http://appspot.com|appspot.com>";
const liveKitUrl = 'https://<our-livekit-host-url>.livekit.cloud';
const receiver = new WebhookReceiver(apiKey, secret);
const egressClient = new EgressClient(liveKitUrl, apiKey, secret);
try {
const event = receiver.receive(req.body, req.get('Authorization'));
console.log('Received LiveKit Webhook data');
console.log(event);
if (event.event == 'track_published') {
console.log('++ Event is track published, starting webhook code ++');
const roomName = event.room.name;
const trackID = event.track.sid;
console.log('Room Name :: ' + roomName + ' :: TrackID :: ' + trackID + ' :: webhook :: ' + webhook);
const info = await egressClient.startTrackEgress(roomName, webhook, trackID);
console.log('--------------------------------');
console.log('Received Info details');
console.log(info);
console.log('--------------------------------');
}
return event;
} catch(err) {
console.log('Error with livekit webhook');
console.log(err);
return err;
}
}quiet-parrot-71005
07/20/2023, 4:14 AMEgressClient(liveKitUrl, apiKey, secret) and egressClient.startTrackEgress(roomName, webhook, trackID); and I see the egress started / stopped in the livekit console.. but now I don't know where else it's missing the URL 😅 slowly progressing thoughquiet-parrot-71005
07/20/2023, 4:15 AMquiet-parrot-71005
07/20/2023, 4:35 AMwss but not the livekitURL which has to be https - so now I'm getting pings on my websocket. with an EOF error I'm working through, according to the livekit console: websocket: close 1006 (abnormal closure): unexpected EOFdry-elephant-14928
07/20/2023, 5:49 AMdry-elephant-14928
07/20/2023, 5:49 AMquiet-parrot-71005
07/20/2023, 5:49 AMdry-elephant-14928
07/20/2023, 6:10 AMdry-elephant-14928
07/20/2023, 6:18 AMif (event.event == 'track_published') {
that it's an audio track, before attemptingquiet-parrot-71005
07/20/2023, 6:23 AMquiet-parrot-71005
07/20/2023, 6:26 AMconst mimeType = event.track.mimeType;
if (mimeType == 'audio/x-raw') {
const info = await egressClient.startTrackEgress(roomName, webhook, trackID);
}dry-elephant-14928
07/20/2023, 6:32 AMaudio/x-raw either, as the client has published opusquiet-parrot-71005
07/20/2023, 6:32 AMquiet-parrot-71005
07/20/2023, 6:33 AM