J
J
Jekson2021-04-02 14:03:32
Python
Jekson, 2021-04-02 14:03:32

How to listen to the response from rabbitmq from the front?

Stack:
python/fastapi
html5/css
rabbitmq (pika)

There is a simple logic for two users to interact. The first user sends an invitation to the second who either accepts or rejects it. The response is sent to the first user. Sending occurs from the form where, when submitting, the message is transferred to the rabbit's queue. The question is, which library can be used to display an incoming request in real time?
The request and the response to it are planned to be recorded in the database. It is possible to read a line with the accepted/decline status from the database and display it, but for this you need to refresh the page to get the update. I think this option is suitable when a person logs in to the site, but not when he is online.
Please share your experience on how best to implement such a connection?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Mirilaczvili, 2021-04-02
@Lepilov

what library can be used to display incoming request in real time?
With SSE , you can send some data to the client without having to refresh the page.
As soon as the status is updated, send a message over SSE with the status or any other information.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question