fix(llc): update currentUser after successful connection

Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
Sahil Kumar
2021-07-27 20:23:28 +05:30
committed by xsahil03x
parent 39449e5700
commit f6cf835b4e
2 changed files with 4 additions and 8 deletions
@@ -325,8 +325,8 @@ class StreamChatClient {
_chatPersistenceClient = _originalChatPersistenceClient;
await _chatPersistenceClient!.connect(ownUser.id);
}
final res = await openConnection();
return res;
final connectedUser = await openConnection();
return state.currentUser = connectedUser;
} catch (e, stk) {
if (e is StreamWebSocketError && e.isRetriable) {
final event = await _chatPersistenceClient?.getConnectionInfo();
@@ -23,16 +23,12 @@ void main() async {
///
/// Please see the following for more information:
/// https://getstream.io/chat/docs/ios_user_setup_and_tokens/
await client.connectUser(
User(id: 'super-band-9', language: 'fr'),
final res = await client.connectUser(
User(id: 'super-band-9'),
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoic3VwZXItYmFuZC05In0.'
'0L6lGoeLwkz0aZRUcpZKsvaXtNEDHBcezVTZ0oPq40A',
);
client.on().listen((e) {
print('e.user.language ${e.me?.language}');
});
final channel = client.channel('messaging', id: 'godevs');
await channel.watch();