Skip to content

Commit 950d413

Browse files
authored
using correct code to disconnect from WS (#667)
1 parent 427630a commit 950d413

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

packages/stream_video/lib/src/call/session/call_session.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import '../../webrtc/peer_connection.dart';
3232
import '../../webrtc/rtc_manager.dart';
3333
import '../../webrtc/rtc_manager_factory.dart';
3434
import '../../webrtc/sdp/editor/sdp_editor.dart';
35+
import '../../ws/ws.dart';
3536
import '../state/call_state_notifier.dart';
3637
import 'call_session_config.dart';
3738

@@ -256,7 +257,9 @@ class CallSession extends Disposable {
256257
_eventsSubscription = null;
257258
await _statsSubscription?.cancel();
258259
_statsSubscription = null;
259-
await sfuWS.disconnect();
260+
await sfuWS.disconnect(
261+
StreamWebSocketCloseCode.closeSocketFromClient.value,
262+
);
260263
await rtcManager?.dispose();
261264
rtcManager = null;
262265
_peerConnectionCheckTimer?.cancel();

packages/stream_video/lib/src/webrtc/peer_connection.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ class StreamPeerConnection extends Disposable {
277277
..onAddStream = null
278278
..onRemoveStream = null
279279
..onAddTrack = null
280+
..onTrack = null
280281
..onRemoveTrack = null
281282
..onIceCandidate = null
282283
..onIceConnectionState = null

packages/stream_video/lib/src/ws/ws.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ import 'connect/connect.dart'
1313

1414
export 'package:web_socket_channel/web_socket_channel.dart';
1515

16+
enum StreamWebSocketCloseCode {
17+
closeSocketFromClient(1000);
18+
19+
const StreamWebSocketCloseCode(this.value);
20+
final int value;
21+
}
22+
1623
/// A simple wrapper around [WebSocketChannel] to make it easier to use.
1724
abstract class StreamWebSocket {
1825
/// Creates a new instance of [StreamWebSocket].

0 commit comments

Comments
 (0)