0

I am new at this part of web developing and was trying to figure out a way of creating a web app with the basic specifications as the example bellow:

  • A user1 opens a page with a textbox (something where he can add text or so), and it will be modified as it decides to do it.
    • If the user1 has problems he can invite other user2 to help with the typing.
    • The user2 (when logged to the Channel/Socket) will be able to modify that field and the modifications made will be show to the user1 in real time and vice versa.

Or another example is a room on CodeAcademy:

  • Imagine that I am learning a new coding language, however, at middle of it I jeopardize it and had to ask for help.
    • So I go forward and ask help to another user. This user access the page through a WebSocket (or something related to that).
    • The user helps me changing my code and adding some comments at it in real time, and I also will be able to ask questions through it (real time communication)

My questions is: will I be able to developed certain app using Django Channels 2 and multiplexing? or better move to use NodeJS or something related to that?

Obs: I do have more experience working with python/django, so it will more productive for me right know if could find a way working with this combo.

1 Answers1

1

This is definitely possible. They will be lots of possibilities, but I would recommend the following.

  1. Have a page with code on. The page has some websocket JS code that can connect to a Channels Consumer.
  2. The JS does 2 simple things. When code is updated code on the screen, send a message to the Consumer, with the new text (you can optimize this later). When the socket receives a message, then replace the code on screen with the new code.
  3. In your consumer, add your consumer to a channel group when connecting (the group will contain all of the consumers that are accessing the page)
  4. When a message is received, use group_send to send it to all the other consumers
  5. When your consumer callback function gets called, then send a message to your websocket