From 295a318217e34da2d8a42e0bfc670c18a68f3567 Mon Sep 17 00:00:00 2001 From: cloudwebrtc Date: Mon, 18 Dec 2023 21:30:28 +0800 Subject: [PATCH] update. --- lib/src/core/engine.dart | 4 +--- lib/src/core/signal_client.dart | 2 +- lib/src/core/transport.dart | 2 +- lib/src/support/websocket_utility.dart | 10 +++++----- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/src/core/engine.dart b/lib/src/core/engine.dart index 62f14a2a..d37c30f2 100644 --- a/lib/src/core/engine.dart +++ b/lib/src/core/engine.dart @@ -866,9 +866,7 @@ extension EnginePrivateMethods on Engine { void _updateConnectionState(ConnectionState newValue, {DisconnectReason? reason}) { - if (_connectionState == newValue) { - return; - } + if (_connectionState == newValue) return; logger.fine('Engine ConnectionState ' '${_connectionState.name} -> ${newValue.name}'); diff --git a/lib/src/core/signal_client.dart b/lib/src/core/signal_client.dart index dc28c0cc..16aa21e7 100644 --- a/lib/src/core/signal_client.dart +++ b/lib/src/core/signal_client.dart @@ -185,7 +185,7 @@ class SignalClient extends Disposable with EventsEmittable { return; } - _ws.sendMessage(req.writeToBuffer()); + _ws.send(req.writeToBuffer()); } Future _onSocketData(dynamic message) async { diff --git a/lib/src/core/transport.dart b/lib/src/core/transport.dart index eb704a82..057618e4 100644 --- a/lib/src/core/transport.dart +++ b/lib/src/core/transport.dart @@ -114,7 +114,7 @@ class Transport extends Disposable { late final negotiate = Utils.createDebounceFunc( (void _) => createAndSendOffer(), cancelFunc: (f) => _cancelDebounce = f, - wait: connectOptions.timeouts.debounce * 2, + wait: connectOptions.timeouts.debounce, ); Future setRemoteDescription(rtc.RTCSessionDescription sd) async { diff --git a/lib/src/support/websocket_utility.dart b/lib/src/support/websocket_utility.dart index 5a3fe3e9..6bc60a66 100644 --- a/lib/src/support/websocket_utility.dart +++ b/lib/src/support/websocket_utility.dart @@ -147,11 +147,11 @@ class WebSocketUtility { _changeSocketStatus(SocketStatus.kSocketStatusConnected); } - webSocketOnMessage(data) { + void webSocketOnMessage(data) { onMessage?.call(data); } - webSocketOnDone() { + void webSocketOnDone() { logger.fine('closed'); if (_socketStatus == SocketStatus.kSocketStatusConnected) { _webSocket?.dispose(); @@ -164,7 +164,7 @@ class WebSocketUtility { } } - webSocketOnError(e) { + void webSocketOnError(e) { WebSocketException ex = e; onError?.call(ex); } @@ -192,12 +192,12 @@ class WebSocketUtility { _cleanUp(); } - void sendMessage(message) { + void send(List data) { if (_socketStatus != SocketStatus.kSocketStatusConnected) { logger.warning('WebSocket not connected'); return; } - _webSocket?.send(message); + _webSocket?.send(data); } Future reconnect() async {