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
{{ message }}
This repository was archived by the owner on Feb 17, 2025. It is now read-only.
I was debugging why I was being notified of deleted statuses whose IDs I didn't recognize. For example, I received the following payload from the mastodon-api message listener:
{event: 'delete',data: 110988663231921360}
Note that this is a number (even though Mastodon streaming API docs claim it should be a string ID). However, if in parser.js I console.log the raw message, here's what it receives:
event: delete\ndata: 110988663231921363\n\n
110988663231921363 (≈2**56.623) is bigger than MAX_SAFE_INTEGER so it gets rounded to the value coming out of the message listener:
>parseInt('110988663231921363')110988663231921360
Note how the two numbers above aren't the same.
Do you have any tips on how the parser should be modified to handle this special case? Should we have a list of events that need to be treated as strings (like delete) and pass that through as-is without any JSON decoding?
The text was updated successfully, but these errors were encountered:
fasiha
added a commit
to fasiha/mastodon-api
that referenced
this issue
Sep 1, 2023
I was debugging why I was being notified of deleted statuses whose IDs I didn't recognize. For example, I received the following payload from the mastodon-api
message
listener:Note that this is a number (even though Mastodon streaming API docs claim it should be a string ID). However, if in
parser.js
I console.log the raw message, here's what it receives:110988663231921363 (≈
2**56.623
) is bigger than MAX_SAFE_INTEGER so it gets rounded to the value coming out of themessage
listener:Note how the two numbers above aren't the same.
Do you have any tips on how the parser should be modified to handle this special case? Should we have a list of events that need to be treated as strings (like
delete
) and pass that through as-is without any JSON decoding?The text was updated successfully, but these errors were encountered: