Best Practices For Building A Chat App? (REST Vs Websockets)
As the title suggests, I'm building a simple chat app in Node/Express + React, and I'm using socket.io to get real time updates.
However, other than the chatting itself, rest of my app is very basic (registering, signing in, creating rooms etc), and while it's definitely doable to make all those requests just socket emits, it feels like bit of an overkill.
So I was thinking of creating a regular REST API for that stuff and outsourcing it into a separate file, then creating another file just for the chatting function itself, where I'd use socket.io, but I'm afraid that it may seem a bit unprofessional, or leave an impression that I don't know how to use sockets well enough.
Key point: When finished, this app will be posted to my portfolio, so I'm not very concerned about what just "can work", but rather what's the best and cleanest way to do it? Should I switch everything to sockets and use them even for basic fetching of lists and stuff? Or is it better practice to mix the two, and use REST for, well, the rest?
In my experience, To mix the two is the best way to do that. I did that in many projects and it worked well. I surely think that modularity is the best way to make code clean and qualified. So, to use both of regular REST API and websocket is more professional. Thank you.
- → OctoberCMS Rain User plugin not working or redirecting
- → Good solution to work with rest-api like SPA with redux?
- → Transformer usage on laravel/dingo API
- → Ember.js JSON API confusion
- → Express - better pattern for passing data between middleware functions
- → Checking passed object existence in Laravel delayed queue job
- → Restrict .htm Pages and Partials in OctoberCMS with Nginx
- → Nested array validation laravel
- → Uploading a file and sending it to the backend with React and Node
- → How to replace the 3rd product with an Image in product list for Perstashop?
- → How should I implement canonical urls in my prestashop theme?
- → Best way to do front-end public and restricted area with October CMS?