C
C
calcium2021-11-14 16:28:58
Django
calcium, 2021-11-14 16:28:58

How to process React requests with Django or create a WebHook like?

Hello everyone, I wondered if it was possible to build a thing similar to WebHook? So that the server itself sends some kind of request, saying that the data has been updated and can be received from the front?
At the moment, requests are coming from the front along the interval. The application is powered by ReactJS + Django REST.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vasily Bannikov, 2021-11-14
@calcium

It seems you need websockets - they are specially made for this kind of task.
Here's how to raise in jango: https://habr.com/en/post/211094/
Here's how to use it in react: https://dev.to/finallynero/using-websockets-in-rea...

V
Vladimir, 2021-11-14
@Casufi

How often do you need to monitor messages from the server? If once every couple of seconds, I would just send requests, as you have now. If you need to keep an open channel and constantly receive changes, use websocket

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question