From cea0cdb5904e160006ae36d58b3fc08b1d5fdfb2 Mon Sep 17 00:00:00 2001 From: Mike Depinet Date: Fri, 13 Dec 2024 15:58:17 -0800 Subject: [PATCH] Websocket client tool results --- example/pubspec.lock | 2 +- lib/src/session.dart | 10 +++++++--- pubspec.yaml | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/example/pubspec.lock b/example/pubspec.lock index 735e593..2ca9876 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -475,7 +475,7 @@ packages: path: ".." relative: true source: path - version: "0.0.7" + version: "0.0.8" uuid: dependency: transitive description: diff --git a/lib/src/session.dart b/lib/src/session.dart index c669312..4474803 100644 --- a/lib/src/session.dart +++ b/lib/src/session.dart @@ -5,7 +5,7 @@ import 'package:livekit_client/livekit_client.dart' as lk; import 'package:web_socket_channel/web_socket_channel.dart'; import 'dart:convert'; -const ultravoxSdkVersion = '0.0.7'; +const ultravoxSdkVersion = '0.0.8'; /// The current status of an [UltravoxSession]. enum UltravoxSessionStatus { @@ -320,8 +320,12 @@ class UltravoxSession { throw Exception("Data must contain a 'type' key"); } final message = jsonEncode(data); - await _room.localParticipant - ?.publishData(utf8.encode(message), reliable: true); + final messageBytes = utf8.encode(message); + if (messageBytes.length > 1024) { + _wsChannel.sink.add(message); + } else { + await _room.localParticipant?.publishData(messageBytes, reliable: true); + } } Future _disconnect() async { diff --git a/pubspec.yaml b/pubspec.yaml index ebb2e41..885d80b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: ultravox_client description: "Flutter client SDK for Ultravox." -version: 0.0.7 +version: 0.0.8 homepage: https://ultravox.ai repository: https://github.com/fixie-ai/ultravox-client-sdk-flutter topics: