Senior Content Strategist, PubNub
IN THIS ARTICLE

    Subscribe to Our Newsletter

    Stay updated with the latest on web, mobile, and IoT, delivered weekly.
    Thanks for subscribing!

    Thanks for subscribing!

    Get ready for some great content.

    SocketIOPubNub and Socket.IO are two separate technologies, independent yet connected. What do we mean by this?

    Socket.IO is a framework with abstracted concepts that makes network communication more robust, allowing developers to open and maintain a socket connection for bidirectional network communication. It has some great realtime features and uses patterns to make it easy to use. One way to think about it:  Socket.IO is to networking as jQuery is to HTML/JavaScript.

    On the other hand, PubNub is a globally distributed data stream network, enabling you to deliver data in under a 1/4 second to anywhere on Earth, securely and reliably.

    How Are PubNub and Socket.IO Connected?

    As we said earlier, Socket.IO is a framework that enables you to open and maintain a socket connection and stream data bidirectionally, and provides some pretty great and easy-to-use design patterns.

    However, building out a Socket.IO application requires you to host and maintain your own cluster of servers. Building a Socket.IO application on top of PubNub removes the need to operate and run your own server cluster.

    Essentially, PubNub removes the need for a server backend. You can do some pretty cool realtime things with Socket.IO, but as your app user base grows, deploying and scaling your realtime backend become important considerations. That’s where PubNub comes in.

    Realtime Functionality

    Socket.IO is great for establishing a connection and streaming realtime data. But in addition to data streaming, PubNub offers a number of other realtime “building blocks” that can be used to enhance your open socket connection.

    • Data Streaming: Publish and subscribe to realtime data streams in under a 1/4 second
    • Presence: Who’s there? Monitor and detect the connection state of users and devices
    • Storage & Playback: Store, retrieve, and play back messages as they happened in realtime
    • Analytics: Visualize and monitor realtime traffic and usage
    • Cross Platform: Publish complex objects that get automatically encrypted, serialized, and delivered to the subscribers within 1/4 second, and then automatically deserialized and decrypted (even across different programming languages and platforms).
    • Security and Access Management: PubNub adds AES data encryption, as well as a full grant/revoke framework to ensure only authorized users can subscribe to realtime data streams.

    Realtime Deployment and Scaling

    Socket.IO, like other open source realtime libraries and frameworks, can provide a selection of these realtime features. However, scaling and deployment is where you may run into roadblocks. Will your app scale to thousands of users and devices all connected simultaneously?

    PubNubSocketIO

    PubNub is able to deliver realtime services on top of realtime protocols and frameworks like Socket.IO, WebSockets, and SignalR, while solving the costly and complex backend challenges for realtime functionality. Where Socket.IO deals with realtime data streaming, it requires you to configure and maintain your own backend. In several of my build vs buy discussions with PubNub customers, development teams began trying to build out their own realtime infrastructure, but soon realized the daunting challenge of doing so.

    Using PubNub and Socket.IO Together

    The PubNub Socket.IO SDK is designed for people who started building their application with Socket.IO, but want to migrate to PubNub. There is no requirement to use Socket.IO library if you are starting with PubNub first.

    Also, those familiar with Socket.IO API will easily be able to port their existing JavaScript-based Socket.IO code directly onto PubNub.

    Socket.IO Get Started Quickly

    Socket.IO allows you to emit and receive custom events. Reserved events are: connect, message, disconnect, reconnect, ping, join and leave.

    Sending and receiving events:

    Whether you’re early in the development stage or ready to deploy your realtime application, PubNub can be easily integrated to ensure scale, reliability and security. Need help or have additional questions? Feel free to reach out to support@pubnub.com, and we’ll get back to you right away!

    Resources
    Resources

    Building a HIPAA-compliant App

    Everything You Need to Know About Developing and Scaling a HIPAA-compliant App
    Download Now
    Building a HIPAA-compliant App
    More From PubNub