Frame parsing only returning first array and discarding the rest of socket message

Open
#240 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
networking

Research direction

Start by reading the Frame class and reproduce the Bitfinex websocket response shown in the issue. Check how multiple WebSocket frames or data objects are consumed, then verify that all arrays from one socket message are returned rather than only the first; compare the result with the public echo-service behavior described.

Written by the indexing model from the issue text.

Description

Hi, I have a problem parsing the messages that the websocket of Bitfinex API sends (wss://api.bitfinex.com/ws/2) after connecting to it and sending the following payload

{
              "event": "subscribe",
              "channel": "book",
              "pair": "tBTCUSD",
              "prec": "R0"
            }

An example of a complete byte string returned by the websocket is the following:

b'\x81\x16[210,[7793198037,0,1]]\x81\x17[210,[7813472121,0,-1]]\x81\x17[210,[7813464771,0,-1]]\x81\x17[210,[7813472713,0,-1]]\x81"[210,[7813472969,8850,0.86764592]]\x81%[210,[7813472987,8850.1,-0.18178494]]\x81%[210,[7813473056,8850.1,-0.30526279]]\x81 [210,[7813473029,8851,-0.06004]]'

However, the parsing process happening in Frame class, is only returning the first array:

[210,[7793198037,0,1]]

and is discarding all the rest of the data.

Am I doing something wrong? should I set some special configuration? Is the protocol implemented in the Frame Class incomplete to handle multiple data objects in the response?

Using public websocket services such as https://websocket.org/echo.html I get all the arrays back, which makes be suspicious about ws4py...

Dominant language
Python
Stars
1.1k
Forks
285
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Lawouach/WebSocket-for-Python

All issues in Lawouach/WebSocket-for-Python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.