Need advice about which tool to choose?Ask the StackShare community!
PubNub vs Socket.IO: What are the differences?
Introduction
PubNub and Socket.IO are both popular real-time communication frameworks used in web development. While they share similar functionality, there are key differences between the two.
Scalability: PubNub is designed for global scalability, offering a distributed network of data centers that can handle high volumes of messages across multiple geographic regions. On the other hand, Socket.IO relies on server infrastructure, which may limit scalability in terms of handling large-scale real-time communication.
Device Compatibility: PubNub provides client libraries for a wide range of platforms, including web browsers, mobile devices, and IoT devices. This makes it suitable for building applications that seamlessly run on different devices. Socket.IO is primarily focused on web platforms and may not have extensive support for other types of devices.
Real-time Message Routing: PubNub uses a publish/subscribe messaging model, where messages are sent to channels and subscribers receive messages from those channels. Socket.IO, on the other hand, uses a bidirectional event-based communication model, allowing clients and servers to send and receive arbitrary events.
Reliability: PubNub offers built-in features like message replay, message history, and guaranteed message delivery, which ensure reliable real-time communication. Socket.IO, while it provides basic reliability features, may require additional configuration or third-party libraries to achieve the same level of reliability.
Presence Detection: PubNub includes built-in presence detection, allowing developers to determine the online status and activity of connected clients. Socket.IO does not provide native presence detection and requires additional implementation to track client connections.
Encryption and Security: PubNub provides end-to-end encryption, protecting data transmitted between clients and servers. It also offers access control mechanisms for securing channels and limiting message access. Socket.IO, while it supports secure connections, may require additional configuration to achieve the same level of encryption and security.
In summary, PubNub offers global scalability, extensive device compatibility, reliable message delivery, built-in presence detection, and encryption features. Socket.IO, on the other hand, is primarily focused on web platforms, offers bidirectional event-based communication, and may require additional configuration for scalability, reliability, presence detection, and encryption.
We (my team) are building an App where we want to have Bi-directional texting, Single Directional Picture, and audio transfer.
We are building all this using Flutter.
There will essentially be 3 apps, 2 Mobile-based (Android and iOS) and 1 Microsoft Based. We've built up most of the code already, and made a few major mistakes but fixed it(namely had no proper state management).
How things will work:
Person A has a Mobile app 1, Person A presses a button that sends a "communication request" into a Pool of requests. Person B on Desktop App chooses a "communication request" from the pool, and engages in Bi-directional texting with Person A. Person B also opens communication with Person C who is on Mobile app 2, and they engage in Bi-directional texting. Person C will be notified of communication requests through Push Notifications.
So far we've been using Socket.IO, however, I'm starting to think that's not the best.
A problem we've encountered so far is that Person A(Mobile App 1 User), is the person who sends a "communication request" into the "Communication Pool". The Mobile App 1 User, can "cancel" the communication at any point in time. When they do that, I would like for a notification to be sent to Person B, the Desktop User, For them to pick up another communication request.
I am not sure how this should be done however, should it be done in the Back-end, then how does the Front-end get notified of the change?
Any advice on which to choose?
It's so simple when you use Firebase to manage the requests just make new field to the request for example callstate with values like "requesting" "incall" "cancelled" and both A and B can update this field.
I am building an IoT application that will utilize connected air quality sensors to provide real-time indoor air quality in offices. I want to be able to share this data with a few different databases, etc.
Wondering if anyone has any advice on which real-time streaming API would be best for this sort of application, or even how I should think about it?
For IoT, we support MQTT along with websockets and SSE. The pattern you're suggesting that involves harvesting data from devices and soaking into a database is easy to achieve with one of the Ably integrations (Serverless functions/webhook) . Here are some tutorials to do things like this: https://ably.com/tutorials/reactor-event-zapier#step2-mqtt-ably
We use Pusher at www.justlearn.com. It works fine. When you reach more users, Pusher gets expensive. We use Pusher for live chat between users. Their software is easy to use. We have had issues with auth on Pusher.
We are starting to work on a web-based platform aiming to connect artists (clients) and professional freelancers (service providers). In-app, timeline-based, real-time communication between users (& storing it), file transfers, and push notifications are essential core features. We are considering using Node.js, ExpressJS, React, MongoDB stack with Socket.IO & Apollo, or maybe using Real-Time Database and functionalities of Firebase.
I would recommend looking hard into Firebase
for this project, especially if you do not have dedicated full-stack or backend members on your team.
The real time database, as you mentioned, is a great option, but I would also look into Firestore
. Similar to RTDB, it adds more functions and some cool methods as well. Also, another great thing about Firebase is you have easy access to storage and dead simple auth as well.
Node.js
Express
MongoDB
Socket.IO
and Apollo
are great technologies as well, and may be the better option if you do not wish to cede as much control to third parties in your application.
Overall, I say if you wish to focus more time developing your React
application instead of other parts of your stack, Firebase
is a great way to do that.
Hello Noam 👋,
I suggest taking a look at Ably, it has all the realtime features you need and the platform is designed to guarantee critical functionality at scale.
Here is an in depth comparison between Ably and Firebase
Hey Noam,
I would recommend you to take a look into 8base. It has features you've requested, also relation database and GraphQL API which will help you to develop rapidly.
Thanks, Ilya
Pros of PubNub
- Massively scalable & easy to use36
- Easy setup25
- Reliable20
- Great support19
- Flexible to integrate to custom applications14
- Sockets at Scale13
- 99.999% availability guarantees13
- High-Performance13
- High-Reliability12
- Multiplexing12
- Scalability7
- High-Availability5
- 70+ SDKs5
- Security4
- Azure Add-on4
- Heroku Add-on3
- Presence3
- Flexible3
- Easy to setup3
- Data Streams2
- Free Plan2
- Server-Side Cache2
- PhoneGap Plugin2
- AngularJS Adapter2
- Data Sync2
- Analytics2
- Support2
- Easy setup and very reliable1
- High cost, going up more in Summer '151
- Cool1
- Angular 2+ integration1
- Documentation, easy to use, great people/service1
- CTO stephen also is A++++++1
- Real time and easy to use.1
- Easy integration with iOS apps1
Pros of Socket.IO
- Real-time219
- Node.js143
- Event-based communication141
- Open source102
- WebSockets102
- Binary streaming26
- No internet dependency21
- Large community10
- Push notification6
- Ease of access and setup5
- Test1
Sign up to add or upvote prosMake informed product decisions
Cons of PubNub
- Costly1
Cons of Socket.IO
- Bad documentation12
- Githubs that complement it are mostly deprecated4
- Doesn't work on React Native3
- Small community2
- Websocket Errors2