Replies: 1 comment 5 replies
-
The Socket.IO event handlers are completely independent of your Django views. You can create them as decorated functions, or if you prefer a class-based style you can use a class-based namespace. There are examples of both approaches in the documentation. To emit an event to the client, you use the |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am working on a Django REST framework project with ReactJS frontend.
I wanted to use a real time update functionality in my project with Python-SocketIO.
The connection between Server and client is successfully established.
The emit functionality is working fine with functional components.
In my project, the views I have written are class based views, using model serializers, and hence I couldn't wrap the view using the decorator.
Below is one of the model, serializer and its view.
model
serializer (using model serializer)
view - class based, created with generic class from rest framework
I got stuck here as I don't have enough knowledge to implement the emit event inside this view.
Please guide me on wrapping the view with event and emiting events.
I am new to programming and request your help on this.
Thanks in advance.
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions