1

I am redeveloping an application with the aim of going along with the more modern techniques. That is how I came across Socket.io, which I integrated with express.js.

I implemented live searching with datatables using socket.io for the filtering & fetching part. Users then can click on individual records and go to a page where they can perform CRUD-operations on these data.

I'm still not sure about how I'm going to implement authentication. What are the pros and cons of using WebSockets vs HTTP for authentication?

Socket.io provides a feature falling back to HTTP if a browser doesn't support WebSockets. So I still do have to implement authentication with HTTP headers/cookies etc. to garantee that all users can use this application, if I am right?

Can WebSockets serve all the needs of an application like I described above and therefore fully replace AJAX calls when my webpage has already opened?

I often see that sockets are used when there is a need for real-time updates, like in a chat app. But does this protocol also fit for RESTful operations in not chat-like apps?

I have two options:

  • Implement authentication with HTTP and then when a user is authenticated WebSockets are open for communication.

  • Implement authentication with WebSockets.

The first option is mixing two protocols in one application and that is something express.js provides. But is this a good approach?

Thanks in advance,

Mike

Maikkeyy
  • 191

0 Answers0