Python websocket parsing

I have a link to the site:

  • wss://stream295.forexpros.com/echo/479/huv_c91t/websocket
  • wss://stream198.forexpros.com/echo/465/8zo98wk6/websocket

How to parse data from these sockets using python c?

Author: gil9red, 2020-06-26

1 answers

You need to connect to a socket (for example, using the websockets library for python) and listen for messages that will come, and then parse them in turn.

import asyncio
import websockets

async def hello():
    uri = "ws://localhost:8765" # url вебсокета
    async with websockets.connect(uri) as websocket:
        await websocket.send("Hello world!") # отправка сообщения
        await websocket.recv() # получение сообщения

asyncio.get_event_loop().run_until_complete(hello())

Code from the official websockets documentation

 2
Author: Mrage, 2020-06-26 15:30:09