43

I watched a codeschool tutorial on Node.js and they imitated a chat server using Socket.IO in their tutorial.

I am also under the impression that Firebase does the same thing.

What is the difference between the two, if there are any?

user3587754
  • 831
  • 2
  • 7
  • 20
  • 4
    SocketIO is an opensource library. Firebase is a cloud service. Both of them use Websockets. But everyone has his own js layer implementation – Mahmal Sami Feb 23 '15 at 15:07

2 Answers2

51

There actually is the difference.

Socket.io is a javascript library to manage sockets. In a web-chat example, you create sockets:

  1. client(s) to server
  2. Server to client(s)

That is, you control all the end-points, and use socket.io as a tool to communicate between your end-points.

In contrast, using firebase you only focus around 1 (client to server)


Pros and Cons of using service versus own infrastructure is a different subject, and heavily opinionated.

alandarev
  • 8,349
  • 2
  • 34
  • 43
  • 4
    But can't you create a web-chat with firebase as well? – user3587754 Feb 23 '15 at 15:23
  • 136
    @user3587754 Yes, let me bring you an example. Imagine an oven (socket.io) and take-away pizza (firebase). Both will let you get an end-product - pizza (web-chat). Later is more expensive (because it is a service), but easier. Though, with oven (socket.io) you have more control, yet it comes with more responsibilities. – alandarev Feb 23 '15 at 15:34
  • 2
    @alandarev what a beautiful explanation! Thanks a lot! – Woppi Dec 13 '16 at 08:10
0

There are many, many differences. For example:

SDKs

Firebase has 9 SDKs, including JavaScript, Android, Unity. Socket just 1 official client library (JavaScript) for browsers.

Realtime Features Firebase has pub/sub messaging, connection state recovery, presence, native push notifications, webhooks. Socket.io doesn't have any of those.

Documentation

Both have pretty good documentation with Getting Started Guides, Information Architecture and Developer Journey, API reference.

Those are just some examples, but here is an in-depth comparison between Firebase and Socket.io