From 4d8786318f9b5e9e9785b6a78470887f7eabf07e Mon Sep 17 00:00:00 2001 From: J <32556193+jo-code@users.noreply.github.com> Date: Wed, 25 Nov 2020 20:56:56 +0100 Subject: [PATCH] #39 fixed logout --- lib/src/connect/meeting/main_websocket/main_websocket.dart | 3 ++- lib/src/connect/meeting/main_websocket/user/user.dart | 1 + lib/src/utils/websocket.dart | 5 +++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/src/connect/meeting/main_websocket/main_websocket.dart b/lib/src/connect/meeting/main_websocket/main_websocket.dart index 3b9ebef..b47ee0d 100644 --- a/lib/src/connect/meeting/main_websocket/main_websocket.dart +++ b/lib/src/connect/meeting/main_websocket/main_websocket.dart @@ -1,5 +1,6 @@ import 'dart:async'; import 'dart:convert'; +import 'dart:io'; import 'package:bbb_app/src/connect/meeting/main_websocket/chat/chat.dart'; import 'package:bbb_app/src/connect/meeting/main_websocket/meeting/meeting.dart'; @@ -87,7 +88,7 @@ class MainWebSocket { moduleEntry.value.onDisconnectBeforeWebsocketClose(); } - _webSocket.close(); + _webSocket.closeWithReason(WebSocketStatus.goingAway); // Call logout URL await http.get(_meetingInfo.logoutUrl, headers: { diff --git a/lib/src/connect/meeting/main_websocket/user/user.dart b/lib/src/connect/meeting/main_websocket/user/user.dart index bfa313c..761cc4b 100644 --- a/lib/src/connect/meeting/main_websocket/user/user.dart +++ b/lib/src/connect/meeting/main_websocket/user/user.dart @@ -17,6 +17,7 @@ class UserModule extends Module { @override void onConnected() { + subscribe("current-user"); subscribe("users"); } diff --git a/lib/src/utils/websocket.dart b/lib/src/utils/websocket.dart index 2f4ca78..3ef37c3 100644 --- a/lib/src/utils/websocket.dart +++ b/lib/src/utils/websocket.dart @@ -51,6 +51,11 @@ class SimpleWebSocket { if (_socket != null) _socket.close(WebSocketStatus.normalClosure); } + closeWithReason(int reason) { + if (_socket != null) _socket.close(reason); + } + + Future _connectForSelfSignedCert( String url, { String cookie,