Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: using correct code to disconnect from WS #667

Merged
merged 1 commit into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import '../../webrtc/peer_connection.dart';
import '../../webrtc/rtc_manager.dart';
import '../../webrtc/rtc_manager_factory.dart';
import '../../webrtc/sdp/editor/sdp_editor.dart';
import '../../ws/ws.dart';
import '../state/call_state_notifier.dart';
import 'call_session_config.dart';

Expand Down Expand Up @@ -238,7 +239,9 @@ class CallSession extends Disposable {
eventsSubscription = null;
await _statsSubscription?.cancel();
_statsSubscription = null;
await sfuWS.disconnect();
await sfuWS.disconnect(
StreamWebSocketCloseCode.closeSocketFromClient.value,
);
await rtcManager?.dispose();
rtcManager = null;
_peerConnectionCheckTimer?.cancel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ class StreamPeerConnection extends Disposable {
..onAddStream = null
..onRemoveStream = null
..onAddTrack = null
..onTrack = null
..onRemoveTrack = null
..onIceCandidate = null
..onIceConnectionState = null
Expand Down
7 changes: 7 additions & 0 deletions packages/stream_video/lib/src/ws/ws.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ import 'connect/connect.dart'

export 'package:web_socket_channel/web_socket_channel.dart';

enum StreamWebSocketCloseCode {
closeSocketFromClient(1000);

const StreamWebSocketCloseCode(this.value);
final int value;
}

/// A simple wrapper around [WebSocketChannel] to make it easier to use.
abstract class StreamWebSocket {
/// Creates a new instance of [StreamWebSocket].
Expand Down
Loading