Setting Up Socket.IO With ReactNative Andriod/IOS For RealTime Communication- Part1

Imranshakeel Khan
2 min readMay 22, 2021

--

Our company has to develop an App for real-time voice communication. This app has custom-designed popups which appear to another user when using one user calls to another user as normally happens. For voice communication, we were using Agora.io. I had to establish and communication server which consumes low memory and acts faster. I can design a custom WebSocket but figured out that socket.io is giving comparatively good facilities as compare to custom design WebSocket logic. Following is the comparison between WebSocket and socket.io

WebSocket Vs Socket.io

SocketIO:

  • Has auto-connect
  • Has namespaces
  • Has rooms
  • Has subscriptions service
  • Has a pre-designed protocol of communication
  • (talking about the protocol to subscribe, unsubscribe or send a message to a specific room, you must all design them yourself in WebSockets)
  • Has good logging support
  • Has an integration with services such as Redis
  • Has fallback in case WS is not supported (well, it’s more and more rare circumstance though)
  • It’s a library. Which means it’s actually helping your cause in every way. Websockets is a protocol, not a library, which SocketIO uses anyway.
  • The whole architecture is supported and designed by someone who is not you, thus you don't have to spend time designing and implementing anything from the above, but you can go straight to coding business rules.
  • Has a community because it’s a library (you can’t have a community for HTTP or Websockets :P They’re just standards/protocols)

WebSocket:

  • You have absolute control, depending on who you are, this can be very good or very bad
  • It’s as light as it gets (remember, its a protocol, not a library)
  • You design your own architecture & protocol
  • Has no auto-connect, you implement it yourself if you want it
  • Has no subscription service, you design it
  • Has no logging, you implement it
  • Has no fallback support
  • Has no rooms, or namespaces. If you want such concepts, you implement them yourself
  • Has no support for anything, you will be the one who implements everything
  • You first have to focus on the technical parts and designing everything that comes and goes from and to your Websockets
  • You have to debug your designs first, and this is going to take you a long time

I am not against anything I am just sharing what I experienced.

Next… Setting Up NodeServer with Socket and configuring in react-native Andriod/IOS

--

--

No responses yet