15

I want major difference between ZeroMQ and socket.io

  1. Performance. ( Is it faster? Scalable? )
  2. Applications. ( Is it used for real time services? )
  3. Browsers Support. ( Which browsers are supported? )
user3666197
  • 1
  • 6
  • 50
  • 92
3ppps
  • 933
  • 1
  • 11
  • 24

1 Answers1

24

Although there are some situations where the two might be used interchangeably, you're comparing apples and oranges.

Socket.io
is a javascript library, composed of two parts- a client-side part meant to run in any browser that supports Web sockets, and a server-side part which runs on NodeJS. It's used to build real-time web applications, meaning you're expecting a lot of back and fourth communication between the client and server (and possibly multiple clients- eg. chat).

ZeroMQ
is a networking library, used to build distributed applications. It's meant to run on the backend. The idea is to enable communication between any combination of different threads or processes, be it on a single machine or a distributed network (which means it uses different transport means for different purposes- and it does so seamlessly). There are usage examples plenty of popular programming languages (PHP, Python, C++, C#, CL, Delphi, Erlang, F#, Felix, Haskell, Java, Objective-C, Ruby, Ada, Basic, Clojure, Go, Haxe, Node.js, ooc, Perl, and Scala), so it is not tied to NodeJS, or any server framework for that matter.

You should read the first couple of pages of the respective docs:
socket.io
ZeroMQ guide

In short:
ZeroMQ doesn't run inside a browser, and isn't necessarily tied to NodeJS or JavaScript- it facilitates communication between different "programs". Socket.io is written in JS, is a browser script and an npm package used when you want real time communication between NodeJS server and the client.

user3666197
  • 1
  • 6
  • 50
  • 92
programstinator
  • 1,354
  • 3
  • 12
  • 31
  • 10
    The only thing I'd add to this is that server side implementations exist for socket.io in many different platforms/languages (python, PHP, Java, etc...) so it is not only available for a node.js back-end and socket.io can be used for server to server communication if desired. That said, since ZMQ doesn't run in the browser, it is only for server-side communication. – jfriend00 Apr 06 '15 at 16:49
  • @jfriend00 Spot on, I didn't even know about the other implementations. – programstinator Apr 06 '15 at 18:37
  • Now that you know socket.io has other implementations, what's the difference? – pjsofts Jun 05 '15 at 20:18
  • Socket.IO enables real-time bidirectional event-based communication. It works on every platform, browser or device, focusing equally on reliability and speed from it's website. – pjsofts Jun 05 '15 at 20:19
  • 6
    @pjsofts: Socket.io is built on top of WebSocket/HTTP. That's an application layer protocol. 0MQ is one layer below, it's merely an abstraction on top of TCP/UDP/etc., so it's more comparable to standard POSIX sockets in this regard. In principle this gives you much better control and speed with 0MQ. OTOH, since Socket.io uses HTTP, it will work e.g. in the browser out of box. – Marek Aug 28 '15 at 11:04
  • 1
    @Goran_Mandic But you could still use ZMQ to create your own JavaScript/jQuery chat application? (Asking because trying to pick something that works with PHP and jQuery for that purpose) – kiradotee Aug 03 '16 at 10:54
  • @kiradotee If you're looking for a Web Socket library that works well with PHP, I'd suggest using Ratchet (I'll leave the link below). If your chat application doesn't require multiple instances of the same app talking to one another (be it on a centralized or distributed backend), then I'd say using ZeroMQ is overkill. Here is the link to Ratchet: http://socketo.me/ – programstinator Aug 03 '16 at 11:43
  • 1
    I'd also like to point out that socket.io does not actually require web sockets and has multiple fallback transports that also work seamlessly. – Patrick Roberts Jun 22 '18 at 08:36