Building Course Assist Part 2: Setting up real-time data transfer functionality using SocketIO.
3 min read
From the time Course Assist was just an idea in my head early last year I've known adding web sockets to the project will be an absolute headache. That was until a few weeks ago when I had a light bulb moment 💡and realised I could easily set it up without finishing every painkiller in my mother's medicine cabinet😂. Let me break it down, the project features a sort of feed page kind of like your news feed on Facebook and also a notifications page. Now the thing about the Facebook news feed or Facebook notification page is it updates in real-time. You don't need to restart the app for you to get new posts or notifications from your friends on Facebook, and that's exactly what I want to implement in Course Assist. In other words when a person posts a question in the user app I want the feed in the expert app to automatically update without any manual page refreshing or when they get a new notification the notification page automatically updates.
Originally I used Django channels which according to the official documentation is a project that takes Django and extends its abilities beyond HTTP - to handle WebSockets, chat protocols, IoT protocols, and more. Now Django channels as it is was already very complicated to set up and deploy then to make matters worse because I was using Django rest framework I couldn't use channels the way it was built to be used, 🤦🏾♂️I had to improvise.
Ran into a few errors here and there but in the end, setting up the feed and notifications with real-time data transfer was successful. I haven't yet deployed the Nodejs server but I'm hoping that when I do, the process will be as smooth as it was setting it up, make sure you stay tuned to the blog to see how that goes in the coming parts.