A
A
Alexander2020-03-22 23:59:15
css
Alexander, 2020-03-22 23:59:15

How to correctly query the server from a spa application?

Good evening, there is a spa application that builds a graph based on data on the server, on the js-vue client on the python server - aiohttp, now I am polling from the client using a loop that sends a request to the server once a second. Maybe there are some other technologies to connect the client and the server, I heard about sockets, would it be right to switch to them or the approach that is above also takes place here?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vladislav Dvoryaninov, 2019-08-27
@test-cats


You forgot to close the parenthesis and put quotes in the url, you may need to put http: or https: before localhost.

F
FeST1Val, 2019-08-27
@FeST1Val

You forgot to close the bracket in the url, and why do you need full paths? simply indicate

<div class="img" style="background-image: url(/wp-content/themes/tema/img/img.jpg)"></div>

D
Dr. Bacon, 2020-03-23
@AlexMine

1. Switching to sockets is worth it if there is a problem with the load on the server, if this does not threaten you, then you can do nothing.
2. When using sockets, the server itself can transmit data to clients, as a result, it is not the clients that poll the server every second, but the server, as soon as the data has changed, transmits them to all connected clients. But you need to understand how to program such a mechanism on the server.
3. aiohttp can websocket

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question