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: make ws connection more robust when user is not set yet #2098

Merged
merged 4 commits into from
May 12, 2023
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
2 changes: 1 addition & 1 deletion examples/TypeScriptMessaging/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -781,4 +781,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: bdd8b333b6b53d6a2a80bcd28a1af34d2155ecca

COCOAPODS: 1.11.3
COCOAPODS: 1.12.1
25 changes: 5 additions & 20 deletions examples/TypeScriptMessaging/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6796,10 +6796,10 @@ statuses@~1.5.0:
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"
integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==

stream-chat-react-native-core@5.13.0:
version "5.13.0"
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-5.13.0.tgz#9425b3aec314e2183bdff5ed0141ddae0fbfaff3"
integrity sha512-dqdq4nInUPIDOXyK55vk4mrOgZTox/aRr7rRxZnQBAivuGOLnrcrv2d2RqWdVG6fC1YX7iatXKDLTThCBH2dUQ==
stream-chat-react-native-core@5.14.0:
version "5.14.0"
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-5.14.0.tgz#81f7890b083fc550d6d5f2e848d96847381df435"
integrity sha512-osgLHxqmLynXqOC5cuXRFDcFf45OtjMgHj00LQG0SiM86LTx/T3cIHhYl4VWLIvoRMuuaubwmhhmBXSnGPU+2w==
dependencies:
"@babel/runtime" "^7.12.5"
"@gorhom/bottom-sheet" "4.4.5"
Expand All @@ -6813,7 +6813,7 @@ stream-chat-react-native-core@5.13.0:
path "0.12.7"
react-native-markdown-package "1.8.2"
react-native-url-polyfill "^1.3.0"
stream-chat "8.2.1"
stream-chat "8.6.0"

"stream-chat-react-native-core@link:../../package":
version "0.0.0"
Expand All @@ -6828,21 +6828,6 @@ stream-chat-react-native-devtools@^1.1.0:
version "0.0.0"
uid ""

stream-chat@8.2.1:
version "8.2.1"
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.2.1.tgz#578015b7ba738b46e7a68e596a9c63b8625dc61d"
integrity sha512-8f+Zkcz2JmSOSw3Q+1ZyC7JLFnB7HezE8TGTY4oeLG54g5r4cCwV0MVGlPaWERZ5darG987xasbOx6eU1Jjesg==
dependencies:
"@babel/runtime" "^7.16.3"
"@types/jsonwebtoken" "~9.0.0"
"@types/ws" "^7.4.0"
axios "^0.22.0"
base64-js "^1.5.1"
form-data "^4.0.0"
isomorphic-ws "^4.0.1"
jsonwebtoken "~9.0.0"
ws "^7.4.4"

stream-chat@8.6.0:
version "8.6.0"
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.6.0.tgz#a686a11337d7d0176f6881874cad73dac86de803"
Expand Down
3 changes: 2 additions & 1 deletion package/src/components/Chat/hooks/useIsOnline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ export const useIsOnline = <
}, [closeConnectionOnBackground, client, clientExists]);

const onForeground = useCallback(() => {
if (!clientExists) return;
// If the user id is not set, we should not open the connection, as it will raise an unneeded error
if (!clientExists || !client.userID) return;

client.openConnection();
}, [client, clientExists]);
Expand Down
Loading