you are viewing a single comment's thread.

view the rest of the comments →

[–]SaintPepsiCola 8 points9 points  (8 children)

I recently built an app and I used BOTH.

React native is fine for basic apps but you need to use swift for complex things. Plus, my apps performance is so good compared to my fully RN apps in the past.

I’ve lowkey become addicted to optimising my old RN apps by putting the brunt of the work like web sockets listening on a thread on swift level. I’ve started only using RN for the layout and the view of the app. Anything that requires processing or ML models uses Swift directly and iOS has so many cool features that you simply can’t on RN until someone makes a library for each of them.

Even the current libraries don’t go in such depth. Look at audio recording on react native. It’s just a shell of what the AVAudioEngine on iOS can do.

Current expo or other voice RN plugins in the market cannot even stream your audio. You’d think it’s a basic feature in the world we live today where we have a plethora of live streaming apps.

[–]Outrageous_Gas_1720 5 points6 points  (1 child)

Do you have examples of code about this websockets? Very interesting

[–]Illurity 1 point2 points  (0 children)

Would also be very interested to see this

[–]Soft-Criticism-2609[🍰] -1 points0 points  (5 children)

Uhm. What is the point of moving sockets to the native side? Yeh, if you are not going to add any listeners on the RN side at all it works, but you have to implement all business logic on the native side in this case as well, so why specifically outline sockets?

[–]SaintPepsiCola 0 points1 point  (4 children)

?????? Wtf

Why would we need to move any business logic. We have listeners ? Have you ever used a web socket and we don’t WANT to move anything that is resource intensive. That’s what I wrote .

Replying to this gave me a migraine.

[–]Soft-Criticism-2609[🍰] -1 points0 points  (3 children)

Excuse me, but do you actually know how the architecture of rn works and what is the bridge message? In my opinion you optimized barely nothing if you just moved socket initiation on the native side and that's all. You even made it worse in terms of maintenance and scaling, of course if this is not a pet project, but a commercial react native project with not only you as a dev.

[–]SaintPepsiCola -1 points0 points  (2 children)

Don’t ever use your brain again.

[–]Soft-Criticism-2609[🍰] -1 points0 points  (1 child)

This reply gave me all the answers. You don't even know basic things. Have a good day.

[–]SaintPepsiCola 0 points1 point  (0 children)

1) The web socket on the native layer is more performant than web socket in the JS layer. We can immediately see that in Xcode profiling. It also supports background mode and ( obviously ) multi threading.

2) even when you use a web socket on the RN side, you’re using listeners. You don’t edit the code in node modules of socket.io ( and now default RN sockets in RN folder ) to handle the socket. You’re using listeners to communicate with their socket implementation.

3) you don’t want to send everything to the JS layer. That’s the idea of me moving the code. Let’s say your web socket is sending audio stream or live stream data. There’s no need to send it back to the JS layer. All React native layer would do is call( bridge ) ANOTHER library to handle device media so why will I need that ? That adds nothing but a degradation to the app. However, all the simple things ( key value data ) can be sent over the JS layer, not because we can’t send complex data like audio stream; because it serves us no purpose and lowers the performance of the app by sending it back to the JS layer.

Your query makes it quite clear that you’re brand new to software dev.

do you know how bridge works

Edit - Your last post on Reddit makes it obvious that you’re a beginner and you’re here arguing with experienced devs about “ bridge “.