Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

AlpacaStream support for ArrayBuffer formatted binary messages #75

Merged
merged 1 commit into from
Jun 26, 2021

Conversation

samwilkins333
Copy link
Contributor

@samwilkins333 samwilkins333 commented Jun 26, 2021

Hi there,

In a React Native project, I ran into a JSON.parse error on instantiating an AlpacaStream because (in this context) the default binary data type for WebSocket seems to be ArrayBuffer rather than Blob. This might be fixable by instead setting this.connection.binaryType = 'blob'; right after instantiating the WebSocket, but I offer this addition for any use cases where ArrayBuffer might be needed.

For reference, the decoding of the ArrayBuffer was taken from here.

@117
Copy link
Contributor

117 commented Jun 26, 2021

Nice catch. 🙂

@117 117 merged commit 5a86e41 into alpacahq:main Jun 26, 2021
@117
Copy link
Contributor

117 commented Jun 27, 2021

Now available in the latest public version 6.2.4.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants