Context
When I browse Reddit or another similar website there are many images that I want to share with someone. The process currently looks like this:
- Copy URL to clipboard
- Paste URL to friend
- Friend clicks URL
- Friend notices funny image
- Repeat above
Problem
This process works great when I’m only sharing 1 or 2 images, but sometimes me and my buddy spend a good 10 minutes sending random images to each other and this process becomes inefficient.
I’m thinking about building a web app that will dynamically load any type of content for both users.
The use case is the following:
- User 1 sends User 2 a link to the web app
- User 1 can pass a link to the web app, which will load link automatically for User 2
- Both users can automatically load content for each other
How to build this?
Solution
Usually clients use AJAX to poll a server for status updates, but in this case, it would make sense for either the clients communicate directly or the server to push to clients updates.
I have looked into browser to browser communication platforms like WebRTC, but I don’t feel that is at a usable state for this type of project.
For the server to push updates to the client, the options are some sort of web sockets. That leaves two major tools: socket.io and SockJS.
After doing a little bit of Googling it seems the common consensus is that SockJS is better than socket.io.
Conclusion
This seems to be a pretty easy project to do, it seems like with SockJS lots of the hard implementation details are taken care of. I want to cover the concepts of SockJS in another blog post though!