agence104 / livekit-server-sdk-php

PHP Server SDK to LiveKit
Apache License 2.0
47 stars 16 forks source link

Webhook controller crashes with LiveKit cloud #24

Open kornatzky opened 4 weeks ago

kornatzky commented 4 weeks ago

When receiving the event participant_left, we get this exception:

"exception": "[object] (Google\Protobuf\Internal\GPBDecodeException(code: 0): Error occurred during parsing: Error occurred during parsing: disconnectReason is unknown. at /home/xxxx/yyy.zzz/vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php:1317) [stacktrace]

kornatzky commented 3 weeks ago

Happens with this code:

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use Agence104\LiveKit\WebhookReceiver;

class LiveKitWebhookController extends Controller
{

    /**
     * Handle the incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function __invoke(Request $request)
    {

        $content = $request->getContent(); 
        $header = $request->header('authorization');
        $receiver = new WebhookReceiver(config('livekit.LIVEKIT_API_KEY'), config('livekit.LIVEKIT_API_SECRET'));
        $data = $receiver->receive($content, $header);

in the line:

$data = $receiver->receive($content, $header);

p-delorme commented 1 week ago

This should be fixed in the latest version.