S
S
suvaka2018-11-30 09:39:15
Python
suvaka, 2018-11-30 09:39:15

How to use python sockets and vue.js?

Hello.

There is a client on Vue and suppose there is an element that displays, for example, the number of players. I get data about the number of players from the database. Now this works in a bunch of axios + api on python (falcon), but it annoys me that it all works at intervals and a bunch of "useless" requests are sent to the server.
Is it possible to do all this through sockets with some minimal set of dependencies?
1) The client connects to the socket server
2) The server returns json with some data
3) The client displays data in the component
4) The socket server accesses the database (with a slight delay), receives the data and, if it has changed, sends it back to the clients.
This is all functionality. Nothing more is required from the "socket server".

Use socket.io or something else? To be honest, I'm already confused.

Thank you.

UPD: something I tupanul.
Python: asyncio + websockets
JS: pure websockets

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Kitaev, 2018-11-30
@suvaka

I use bare web sockets on the back of django-channels. View has nothing to do with it, it only gives reactivity.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question