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

@react-native-community/netinfo not available on visionOS // workaround? #143

Closed
derwaldgeist opened this issue Jan 11, 2024 · 11 comments · Fixed by #145
Closed

@react-native-community/netinfo not available on visionOS // workaround? #143

derwaldgeist opened this issue Jan 11, 2024 · 11 comments · Fixed by #145

Comments

@derwaldgeist
Copy link

Hi, I am trying to make this package to work on the new Vision Pro glasses. However, CoreTelephony is not supported on this device, hence adding @react-native-community/netinfo breaks the build.

Would there be a chance to detect connection breakups in another way? I guess this is what the library is actually being used for, as the logs state that auto-reconnect does not work without this package.

@jankapunkt
Copy link
Member

I was already thinking of making netinfo entirely optional / injectable because by default it contacts Google which is also not the cleanest practice imo...

However, if I just remove the netinfo it would break lots of other builds.

Maybe a good solution for now is to have a flag to disable netinfo (this skipping connection checks and blind-Connect to the Meteor backend). If the flag is falsy then the require of netinfo would not be called and since it's an optional dependency it should not break anything.

Would that be a viable option?

@derwaldgeist
Copy link
Author

Thanks for your super fast response. Yes, that would make sense. Does this mean that one would have to implement a proper auto-reconnect yourself?

I am actually evaluation this as an alternative to implement a Meteor-connected app in native Swift for a visionOS, because I could not find any DDP implementation for iOS / visionOS that is actively being maintained. React native might be an alternative, since I am already using React in my Meteor web frontend.

Are you aware of any native implementation of DDP? I read on the Meteor forums that the RN version of Meteor actually uses RN's websocket implementation under the hood. I was wondering how this actually works.

@jankapunkt
Copy link
Member

@derwaldgeist I'm actually not aware of any native DDP implementations. Regarding websocket you might scan through the react native repo and search for websocket, they have at least some c++ around there implementing some websocket stuff. If you have native websocket then youmight be able to implement DDP as it's just a protocol

@jankapunkt
Copy link
Member

@derwaldgeist please review #145 in the meantime I create an RC for you to test

@jankapunkt
Copy link
Member

@derwaldgeist I crated a release for you to install and test: 2.8.0-rc.0

Please install via npm install @meteorrn/core@2.8.0-rc.0 then, important, run Meteor.connect with options { NetInfo: null }

@derwaldgeist
Copy link
Author

derwaldgeist commented Jan 17, 2024

Thanks! Will do. I have decided in the meantime that I go for the native path, for other reasons. I could make this native library work on visionOS:

https://github.com/engrahsanali/MeteorDDP

Yes, I could also roll my own, but I pefer adapting an existing library if possible. I already did this for Unity, using an abandoned C# implementation. Implementing the base DDP protocol is not that complicated, but handling the data storage and care for mobile connections is not trivial. I had to patch that library quite a bit to make it work reliably. So kudos to you for making it possible on RN. There's a good chance that I will use that for other projects in the future. On visionOS, however, the native path makes more sense, as the system itself is already quite unstable, so adding more "moving parts" would make things even worse. That's also the reason why I am not using Unity for this anymore, as I do for iOS and Android.

@jankapunkt
Copy link
Member

Could you still please test the RC release, if it works please approve the linked pull request, so I can publish the new releases for everyone

@mattblackdev
Copy link

@jankapunkt the RC is working for me, thanks! FYI with NetInfo: null there's a YellowBox saying "NetInfo not installed, so DDP will not automatically reconnect".

@jankapunkt
Copy link
Member

@mattblackdev thanks for the feedback! I think the warning could be removed if NetInfo is null, as you may know what you're doing when explicitly setting it to null. What do you think?

@mattblackdev
Copy link

mattblackdev commented Jan 23, 2024 via email

@derwaldgeist
Copy link
Author

derwaldgeist commented Jan 27, 2024

Could you still please test the RC release, if it works please approve the linked pull request, so I can publish the new releases for everyone

Hi, I just tested it, worked for me on visionOS and iOS - great job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants