I have a list of asyncio tasks which contains with connecting,handshaking and receiving data from a websocket. This process is running correctly but sometimes the connection of one of the websocket (or maybe all of them) is closed. How can I detect and make a new conncetion to the closed one? Here is the code which I use: According to
Tag: websocket
Proper way to cancel remaining trio nursery tasks inside fastAPI websocket?
I’m still quite new to websockets and I’ve been given a problem I’m having a hard time solving. I need to build a websocket endpoint with FastAPI in which a group of tasks are run asynchronously (to do so I went with trio) with each task returning a json value through the websocket in realtime. I’ve managed to meet these
What is the best way to document websocket messages in Aiohttp/Python?
I use aiohttp-swagger to create useful documentation of my http endpoints, but I also have websocket which can send/receive several types of messages (all json for the project), what is the best way to document these messages? Answer AsyncAPI is the analog of the OpenAPI Specification (fka Swagger Specification) for WebSockets. As of November 2021 there are the Asynction and
Use the same websocket connection in multiple asynchronous loops (Python)
I am running two loops asynchronously, and want both to have access to the same websocket connection. One function periodic_fetch() fetches some data periodically (every 60 seconds) and sends a message to the websocket if a condition is met. The other retrieve_websocket() receives messages from the websocket and perform some action if a condition is met. As of now, I
Push live updates through Socket
I need to pass live data from a python script to my server (made with FastApi) and from this server I need to pass all of them to a client (made with Angular). Currently I’m doing Http PUT requests from my script and then I’m using Websocket to pass the updates to the client. The problem is that whenever my
Send / receive in parallel using websockets in Python FastAPI
I will try to explain what I am doing with an example, say I am building a weather client. The browser sends a message over websocket, eg: The server queries the weather every 5 minutes and updates the browser back with the latest data. Now the browser could send another message, eg: Now I the server should STOP updating the
GoneException when calling post_to_connection on AWS lambda and API gateway
I want to send a message to a websocket client when it connects to the server on AWS lambda and API gateway. Currently, I use wscat as a client. Since the response ‘connected’ is not shown on the wscat console when I connect to the server, I added post_to_connection to send a message ‘hello world’ to the client. However, it
How to let a Flask web page (route) run in the background while on another web page(route)
So i’m creating this application and a part of it is a web page where a trading algorithm is testing itself using live data. All that is working but the issue is if i leave (exit) the web page, it stops. I was wondering how i can keep it running in the background indefinitely as i want the algorithm to
Websocket Client not receiving any messages
I have Python client which opens a websocket connection to a server and subscribes to particular topic using STOMP protocol, subscription goes just fine as i see on the server all is fine. However, When the server publishes a few messages the client does not receive any. Here are the codes used: Client Code server uses to publish the message:
electron/socket.io client – python-socketio/aiohttp server // fail to connect
This websocket connection fails. The funny thing is this was working a couple days ago. I downgraded electron from 6 to 5.0.6 but this didn’t help. Server Client (also tested from pure node) When I try it in the browser, I get cors error. Thus, I allowed cors which made it work When I run this from electron/node now, I