-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Show Connected via Pusher status #261
Conversation
I'm getting the following error when trying to run this, but it isn't obvious to me what is causing it. Did you run into this while getting
Also adding @tgolen as a reviewer since I'll be OOO til the 31st. |
Pretty sure this just needs master merged I will take a quick look |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to fix some conflicts
Conflicts are fixed now on this one. |
Real excited for this one... |
Fixes #252
This PR colorizes the dot next to a user's name when they have an "active connection"
Previously we set the user to "offline" when Pusher disconnects or when they successfully make an API request. This adds another layer to set them online and offline when they lose connectivity via the
NetInfo
package.Note: Disconnecting from Pusher via a bad internet connection or turning off Wi-Fi takes about 10-15 seconds. So we can't really "trust" that we are truly connected to Pusher or not since we could have lost connectivity via Wi-Fi well before Pusher recognizes that we have been disconnected.
To get around this I spent some time focusing on getting the
NetInfo
native module to work.At first, I could not get it working in RN4W even though it's supposed to work so I dug around in the source code for the package and realized that when a react native library supports multiple platforms the
react-native-web
source files will have aweb.js
extension. Added that to the webpack config and it began to work on web.cc @AndrewGable
Another Note: There's a bug on iOS Simulator that prevents
NetInfo
from working correctly so test with a real iOS device and throw it into Airplane mode to see what happens.