livekit / client-sdk-flutter

Flutter Client SDK for LiveKit
https://docs.livekit.io
Apache License 2.0
244 stars 122 forks source link

publishData results in TimeoutException on mobile platforms #114

Closed Parfyonator closed 2 years ago

Parfyonator commented 2 years ago

Problem

For some reason publishData method of LocalParticipant class fails to send message on mobile platforms (iOS/Android), although it works fine on web: during the connection to the same room participants receive messages sent by users connected with web versions of the app, while messages sent by mobile clients never received by any participant.

During the debug stage on mobile devices the clicking on send demo data button results in TimeoutException after some delay:

E/flutter (17084): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: LiveKit Exception TimeoutException Timeout

Reproduce

This behaviour can be reproduced with the example from this package.

Additional

I checked LiveKit deployment with LiveKit Tester (https://livekit.io/connection-test). Everything seems to work fine (all tests passed).

Flutter version: 2.10.5

Dart version: 2.16.2

Parfyonator commented 2 years ago

I didn't have much time to dig into this problem but turns out that omitting this check "solves" the problem: it doesn't crash the application but eventually lets me send messages via the data channel. It means that the data channel is actually opened and ready to send data but for some reason this check evaluates to true and starts the process of waiting for the channel to open, which results in TimeoutException.

hiroshihorie commented 2 years ago

interestingly, I can't reproduce this. What is your server version ?

Parfyonator commented 2 years ago

Hi. v0.15.6 I assume. Is there a straightforward way to check the version of the currently running livekit server? Docker says that it is running the latest version of the livekit/livekit-server image. Command docker image inspect gives me version v0.15.6 ("org.opencontainers.image.version":"v0.15.6").

UPD: I double checked with LiveKit Tester and it is indeed 0.15.6

image

davidliu commented 2 years ago

@hiroshihorie not sure if it's related at all, but looks like there's an issue where the dataChannel id gets changed and the underlying flutter-webrtc can't locate the datachannel any more. I'll look into fixing that.

davidzhao commented 2 years ago

This issue had been fixed. please reopen if this continues to be a problem.