import requests
import websocket
from websocket import create_connection
websocket_url = "wss://likurgus.com"
def filter_websocket_traffic(websocket_url):
ws = create_connection(websocket_url)
while True:
try:
data = ws.recv()
print(f"Received data: {data}")
if len(data) == 148:
print("Filtered data:", data)
except websocket.WebSocketConnectionClosedException:
print("WebSocket connection closed.")
break
filter_websocket_traffic(websocket_url) Websocket ile alakalı soru
1
●136
- 28-12-2023, 18:03:45Merhaba arkadaşlar bir sitenin websocket serverinden gelen paketlerin boyutuna göre filtreliyorum mesela 148 baytlık bir paket gelince bildirim alacağım aslında bunu yaptım zaten ama sorun çok gecikmeli(nerdeyse 7-8 saniye kadar) çalışması bu konuyu nasıl aşarım. Bir sürü paket geliyor chrome'nin inspect kısmındaki wss gibi görmek istiyorum.
- 29-12-2023, 19:49:27
import asyncio import websockets websocket_url = "wss://likurgus.com" async def filter_websocket_traffic(): async with websockets.connect(websocket_url) as ws: while True: try: data = await ws.recv() print(f"Received data: {data}") if len(data) == 148: print("Filtered data:", data) except websockets.ConnectionClosedError: print("WebSocket connection closed.") break asyncio.run(filter_websocket_traffic())