PubNub

Building Chat with SDKs versus Components

When building a new chat application or integrating chat into an existing application you may be asking yourself if you should be building with chat components or using one of the PubNub SDKS.

PubNub Chat Components are ready-made building blocks you can use to either create web and mobile chat apps from scratch or add chat features to your existing applications.

PubNub SDKs enable you to build connected experiences with powerful hosted messaging APIs.

This how-to will explain when you should use chat components and when you should use an SDK to build a chat application. Start by comparing the pros and cons of each.

Building with Chat Components - Pros and Cons

Pros:

  • Easy and portable 'building blocks'.

  • Less to understand - Focus more on the features and not the inner workings.

  • Fast - build a working app in just a few minutes.

  • Great for proof of concepts.

  • Customizable and configurable for various chat formats.

  • There are PubNub Chat Components for React (JavaScript), Android (Kotlin), and iOS (Swift).

Cons:

  • Hard to customize functionality beyond what's built in.

  • Not as expandable - custom integrations will be harder to add.

  • Not available in all languages.

  • Harder to understand how it works behind the scene.

Building chat with PubNub SDKs - Pros and Cons

Pros:

  • Limitless possibility - Build what you want how you want it.

  • Tons of SDKs.

  • Customizable to any form you want.

  • Best for production - Have more control and trust how it works will be best suited for your app.

  • Build more than chat - Use PubNub SDKs features in other parts of your application with no additional dependencies.

  • Easy to understand behind the scenes - debug easily.

Cons:

  • There's more to understand.

  • Proof of concepts may take longer.

  • You'll have to build chat features yourself.

  • Less 'pre-built' or 'pre-made' functionality.

Examples

Another helpful way to compare Chat Components and SDKs is to examine how they are built.

For PubNub Components: Take a look at the PubNub Group Chat Demo. View the code on GitHub to compare.

Things to notice:

  • You import the components you need for the functionality you want.

  • Most of the chat functionality happens within the components.

Also, check out this tutorial or this one on using PubNub Components to build chat apps.

For PubNub SDKs: Take a look at this JavaScript Chat Tutorial Application. View the code on GitHub to compare.

Things to notice:

  • You use SDK features directly to create the functionality you want.

  • All of the functionality has to be built and it's customized to how we wanted this app to work.

Also, check out these tutorials on using PubNub SDKs to build chat apps.

Deciding on using an SDK or using Chat Components

Building a demo for proof of concept - Use Chat Components. Chat Components will be the fastest way to get started and have a working app.

Adding chat to an existing application - Use PubNub SDKs. You'll have more options and be better able to maintain and debug for production.

Building chat in a new app - Use PubNub SDKs. You'll be able to take advantage of the extra flexibility and direct access to SDK features for other parts of your app. However, you can use Chat Components if you're trying to see what chat would look like before you commit to building.

Something else? Check out our other building chat scenarios.