what is the Most preferable socket package

I have come across come across some django web socket packages during my research, can anybody help to suggest the best for a chat app (socketio, django channels and django websocket)

1 Like

The django-websocket project is abandoned, they recommend Django Channels.

If you want a pure-Django solution, Channels is the way to go.

Socket.IO is a higher-level protocol that runs on top of websockets among others, along with providing other features. Unfortunately, the only truly reliable server-side implementation is going to be the official Node.js implementation. This is fine if you want to run your communications over a Node.js server - but to be really effective, you’re still going to want to run channels then to communicate with that server.

2 Likes

A very big thanks to you ken for the explanation.
one more thing, if i want to build a light and flexible chat application with django i can comfortably use django channels and asynchronouse views. i ask this because i was talking to a recruiter who was suggesting Node.js over django for this kind of job.
furthermore, what is your take on HTMX (when do suggest i use it)

In the most general of terms, if all you’re looking to build is a chat application, then yes - I’d also probably suggest Node.js over Django. (There are many other factors that would make me change my mind on that decision, but in the absence of any larger context, I’d agree with the recruiter here.) It’s a more mature platform and more active environment for doing those types of applications.

Regarding HTMX, I’m not really all that familiar with it, just what I’ve read about it. I haven’t even tried it yet.

So with that in mind, my very simple understanding of it is that I’m currently thinking of it as “jQuery-lite” or “vue-lite”. I see it as a way that I could add some of the functionality that those libraries provide without writing JavaScript code.
I can also see the benefit of having those behaviors associated directly with the html elements rather than having the html in one file and the JavaScript in another file.

When to use it? Not sure I have a worthwhile answer for that one. @adamchainz ? @mblayman ? @CodenameTim ? Any of you interested in chiming in? (Picking on you three because my memory leads me to believe y’all have commented on htmx here before. I could well be wrong…)

2 Likes

I haven’t used HTMX, but have mentioned for others to investigate for their own options. It does sound like it’s possible to use HTMX over websockets, but it’s under active development. I personally would shy away from that for a production use case until that’s no longer the case.

To add to your options @kalistos1, keep in mind there are services out there that allow you to integrate pre-built chat apps such as SendBird or PubNub or you can buy the websocket functionality via Pusher or others.