Sign in

Realtime chat with flask, socket.io and angular

Recently I started making web applications using python. Given I am so unfamiliar with the frameworks available and that I’ve always wanted to learn how to do realtime applications with socket.io, I thought was a good idea to try to make a chat with flask, socket.io and angular as an exercise.

The back-end

So socket.io is a library that enables event-based communication between clients and a server. For this chat application, I thought the simplest thing would be to handle three different events:

  1. A user disconnects
  2. A user sends a message

Front-end

The Angular front-end is a bit convoluted to be described here. But briefly, I am using two services: The LoginService (login.service.ts ) and the ChatService (chat.service.ts ) . The LoginService handles the sign_in event:

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store