Skip to content

Expose: Sdk socket methods #31

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

Closed
wants to merge 1 commit into from
Closed
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
15 changes: 15 additions & 0 deletions lib/flutter_waterbus_sdk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,21 @@ class WaterbusSdk {

CallState get callState => _sdk.callState;

// Ws Socket
bool get isWsConnected => _sdk.isWsConnected;

void reconnectWs({required Function callbackConnected}) {
_sdk.reconnectWs(callbackConnected: callbackConnected);
}

void connectWs({bool forceConnection = false}) {
_sdk.connectWs(forceConnection: forceConnection);
}

void disconnectWs() {
_sdk.disconnectWs();
}

// Private
WaterbusSdkInterface get _sdk => getIt<WaterbusSdkInterface>();
CallKitListener get _callKitListener => getIt<CallKitListener>();
Expand Down
19 changes: 19 additions & 0 deletions lib/waterbus_sdk_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -434,4 +434,23 @@ class SdkCore extends WaterbusSdkInterface {

@override
CallState get callState => _rtcManager.getCallState();

// Ws
@override
bool get isWsConnected => _wsHandler.isConnected;

@override
void reconnectWs({required Function callbackConnected}) {
_wsHandler.reconnect(callbackConnected: callbackConnected);
}

@override
void disconnectWs() {
_wsHandler.disconnection();
}

@override
void connectWs({bool forceConnection = false}) {
_wsHandler.establishConnection(forceConnection: forceConnection);
}
}
6 changes: 6 additions & 0 deletions lib/waterbus_sdk_interface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,11 @@ abstract class WaterbusSdkInterface {
Future<void> disableVirtualBg();
Future<void> setPiPEnabled({required String textureId, bool enabled = true});

// Ws
void connectWs({bool forceConnection = false});
void disconnectWs();
void reconnectWs({required Function callbackConnected});
bool get isWsConnected;

CallState get callState;
}
Loading