You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use Server-Sent Events. Each update comes as patch to previous state. Initial state received with GET /api/torrent/{id}/piece call.
Variant 1
Text message with base64 encoded state.
Variant 2
Each message has left attribute, which says how much pieces still not downloaded. Next is sorted array "hunks". patch is map with fields "off" and array of bytes, each represents 8 pieces.
Example:
Initial state: [1, 0, 0, 128] or in other words: we have two pieces with indexes 7 and 24. We have in total 30 pieces and 28 left to download.
Updated state would be [129, 128, 0, 192], we downloaded yet 3 more pieces and we have 25 pieces to downloaded. Maintaining this balance can help frontend to identify desynchronization and rerequest state.
Looks like probably this is not we need exactly, because size of hunks can easely overcome such of just plain state. So we would now implement Variant 1, just it is much simplier.
The text was updated successfully, but these errors were encountered:
GET /api/torrent/{id}/piece/stream
We use Server-Sent Events. Each update comes as patch to previous state. Initial state received with
GET /api/torrent/{id}/piece
call.Variant 1
Text message with
base64
encoded state.Variant 2
Each message has
left
attribute, which says how much pieces still not downloaded. Next is sorted array "hunks". patch is map with fields "off" and array of bytes, each represents 8 pieces.Example:
Initial state:
[1, 0, 0, 128]
or in other words: we have two pieces with indexes 7 and 24. We have in total 30 pieces and 28 left to download.Updated state would be
[129, 128, 0, 192]
, we downloaded yet 3 more pieces and we have 25 pieces to downloaded. Maintaining this balance can help frontend to identify desynchronization and rerequest state.Looks like probably this is not we need exactly, because size of hunks can easely overcome such of just plain state. So we would now implement
Variant 1
, just it is much simplier.The text was updated successfully, but these errors were encountered: