Learn Socket.IO with Python and JavaScript in 90 Minutes!

Posted by
on under

The video below contains a complete 90 minute Socket.IO course using Python and JavaScript.

This is the list of chapters, each with a link to the code for each part of the tutorial:

Become a Patron!

Hello, and thank you for visiting my blog! If you enjoyed this article, please consider supporting my work on this blog on Patreon!

  • #1 Lawrence said

    Hi Miguel, loving the content, I have a query on sockets use. If I have a user selecting a date range and the data is fetched from database using a loop in a class method, one day at a time, would this be a good use case for sockets or would you recommend another approach?

  • #2 Miguel Grinberg said

    @Lawrence: you may want to also consider streaming for your use case, which is easier to implement.

  • #3 Braian said

    Hi Miguel,

    I managed to connect to a websocket server to get information stream and at the same time, using socket io to deliver that information in real time with no luck.
    Do you know if it’s possible to use Flask server as a client to capture the info and then send it to clients through socket io in real-time?



  • #4 Miguel Grinberg said

    @Braian: if you have code to connect to this WebSocket service in Python you should be able to use it inside a Flask application, maybe in a background thread so that it does not interfere with the server.

  • #5 Rupesh Shah said

    Hi Miguel,

    I have NodeJS socket.io server with Python native as socket.io client. I am using python-socketio asyncClient. Server uses redis adaptor. In python code, I just have print (data) in event handling. What I have noticed is that python client loses some events (I am trying approx 3 seconds apart) sent by the server as I don't see the output of print (data) on the console. I would like to mention that I do see the message in redis-cli though and that means server is sending the message fine but Python client is unable to retrieve it for some reason. What could be the problem?

  • #6 Miguel Grinberg said

    @Rupesh: If you think the Python client has a bug, then see the troubleshooting section of the documentation to learn how to generate logs that cover the problem. Then file an issue on GitHub with those logs. For this issue it may also be necessary that you capture logs from your Socket.IO server (looking at Redis is not enough to ensure a message was sent).

  • #7 Konstantin said

    Hi Miguel,

    Can you show example of auth by cookie? Can’t solve this problem(

  • #8 Miguel Grinberg said

    @Konstantin: The session example in the Flask-SocketIO repository shows cookie authentication with Flask-Login.

Leave a Comment