All Questions
40 questions
1
vote
0
answers
22
views
WebSockets message sending order
I am making blocking requests calls in a WebSockets server just to test a thing out, but I experienced a weird behavior.
There is one client connection, sending a single message. The message is ...
0
votes
1
answer
70
views
Is there an issue if two asyncio tasks, one reads and one writes, uses one single websocket at the same time?
I have the following simplified code:
import asyncio
import websockets
async def read_from_ws(websocket):
async for message in websocket:
print(f"Received message: {message}")
...
0
votes
0
answers
27
views
Backend WebSocket server causes client page to refresh unexpectedly
I'm working on a radio web project that streams radio stations through a web interface. The backend, written in Python, uses WebSockets to receive messages from the client and returns the currently ...
0
votes
0
answers
88
views
WebSocket Closes Unexpectedly in TTS Service with Multiprocessing and Asyncio
I am developing a TTS (Text-to-Speech) service using multiprocessing and asyncio in Python. My main application integrates other components using queue.
However, I'm encountering an issue where the ...
1
vote
1
answer
393
views
run an async websocket loop in background of flask app
I am trying to build an app which will connect to a websocket (for streaming data) and provide this data with rest API. I am using Flask for creating my API and websockets package for connecting to ...
0
votes
3
answers
473
views
while True in async programming
I have this function:
async def on_event(event: dict):
for func in MESSAGE_LISTENERS:
await func(getMessage(event['data']))
and this decorator which appends the function into ...
1
vote
1
answer
352
views
Python Streaming data websocket asyncio
Can i get some help please i have this code below everything works fine but after a while i receive this error i am using Anaconda Spyder IDE i am not sure what the issue is the script will run but ...
1
vote
0
answers
81
views
How to make a python multi-threading scraper as a websocket server
I currently have a python multi-threading scraper that looks like following, how can I turn this into a websocket server so that it can push message once the scraper found some new data? Most ...
0
votes
1
answer
177
views
How do you exit this websocket and eventloop example?
!/usr/bin/env python
import asyncio
import websockets
buttcount=0
async def hello(websocket, path):
global buttcount
name = await websocket.recv()
print(name)
if name=="butt&...
0
votes
1
answer
465
views
python websockets message queue getting too long, resulting in stale messages
Having the following design problem: I open a websocket connection and send multiple messages every second to get open risk.
What’s happening is the message queue is building up wit a lot of “stale” ...
1
vote
1
answer
233
views
Better way of outputting variable from websockets with asyncio?
I have been playing around with websockets and asyncio to get price data streamed from Bitstamp. After connecting to the websockets feed I am struggling to return the data I'm receiving for use in ...
0
votes
1
answer
187
views
How to run async function in a new thread
I want to run async def orderbook() function in new thread but the code not working ,the code stop at loop = asyncio.new_event_loop() in orderbook_callback()
I don't understand why, the ...
3
votes
1
answer
2k
views
Best way to handle 2 websocket connections in the same time
i am handling data from 2 websocket servers and i would like to know whats the fastest way to handle both connections in the same time given that the 1st connection would send data every 0.1-10ms.
...
0
votes
0
answers
452
views
how keep function printing the websocket response using pyppeteer
how i keep my async function opened priting a response from websocket? just like await asyncio.sleep(1000)
import asyncio
from pyppeteer import launch
async def main():
browser = await launch(...
2
votes
1
answer
1k
views
Getting an error with the python asyncio gather
I don't know why I keep getting this error, I am trying to gather a websocket and a discord bot. So i can run them from the same file, but I keep getting the error posted below the code. Should I ...