Skip to main content

All Questions

0 votes
1 answer
217 views

Cannot access path in websockets.serve handler

I cannot find a way to access the path of a websocket connection, docs say Receiving the request path in the second parameter of connection handlers is deprecated. python version: 3.12.6 websockets ...
Harold Obasi's user avatar
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}") ...
Viet Than's user avatar
  • 320
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 ...
Rahul Anand's user avatar
0 votes
1 answer
211 views

Websocket how to receive two request chatgpt at the sametime

I have a websocket (in Django) to receive request from client (reactjs). The request calls chatgpt api to stream its response to client. class GPTAPIConsumer(AsyncWebsocketConsumer): async def ...
Trong Lam Phan's user avatar
1 vote
0 answers
494 views

Python - Websocket recv timeout - asyncio?

So I'm doing some stuff with the websocket module and I want to add a timeout to the recv method. I'm familiar with a messy way of doing this with threading but I'm hoping to avoid that mess. When I ...
T. Smith's user avatar
  • 154
1 vote
0 answers
176 views

handle data from asyncio websockets tasks

i've got a script that retrieves data from websockets streams(crypto stocks of course:]), then i need to handle it, but the thread freezes in infinite loop, geting and geting data in tasks. i use ...
Jimmy Router's user avatar
3 votes
0 answers
303 views

How to connect multiple clients simultaneously to a websockets server that uses NATS?

Does anyone know why only one client is able to connect at the same time to a websockets server that uses NATS? Here is my code: subscribehandlernats.py import asyncio import signal from nats.aio....
Takewood's user avatar
0 votes
0 answers
114 views

Python object has no object has no attribute 'asyncio'?

I am trying to connect two nodes via WebSocket API but I have trouble letting the kern object do the API call. And I am also trying to let the node to node communication work in another thread. Or ...
Minrui Tian's user avatar
3 votes
1 answer
2k views

How to return data on WebSocket when new database entry is made FastAPI

I am trying to write a simple API that collects measurements, and then streams them live to clients over a websocket with FastAPI. There are plenty of tutorials on how to send messages when triggered ...
Sean Palmer's user avatar
0 votes
0 answers
552 views

tradingview websocket is blocked when receiving message with pyppeteer

thanks to this thread i was able to connect to tradingview socket with pyppeteer. But i am not able to work with the response otherwise i block the whole program. I can also not make the function &...
McMoe's user avatar
  • 1
2 votes
1 answer
2k views

How to run an asyncio/websockets server in a separate thread: ERROR: -> There is no current event loop in thread

I am trying to add web-socket functionality (to respond to some occasional inbound web-socket based requests) to an existing small python desktop app that is already doing other things. It already ...
Scott B's user avatar
  • 35
2 votes
1 answer
910 views

missing some messages in websocket client?

I am trying to implement a websocket client that connects to the popular crypto exchange FTX. I have simplified my problem to the following example code below: import asyncio import websockets import ...
Paul's user avatar
  • 1,186
0 votes
1 answer
774 views

Websockets run client side and server side in 1 script with asyncio

I have 2 Python scripts running currently, 1 is client side script and 1 is server side script. They run perfectly ok. But, I want to combine both into 1 script to optimize data transfer. Below are ...
Pak Ho Cheung's user avatar
1 vote
1 answer
14k views

Python websockets ping / pong / keep-alive errors

I have a simple script reading messages from a websocket server and I don't fully understand the keep-alive system. I'm getting two errors with practically the same meaning sent 1011 (unexpected error)...
Tim's user avatar
  • 296
0 votes
1 answer
795 views

How to create a python variable from a json format

I want to create a global variable from json data. I'm sending the json data with websockets from a server to a client and I want that when the client receives json data, it creates a global variables ...
Humberto Adhemar's user avatar

15 30 50 per page
1
2 3 4 5 6