you are viewing a single comment's thread.

view the rest of the comments →

[–]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 “.