-
Notifications
You must be signed in to change notification settings - Fork 157
Replace Blob::array_buffer
with FileReader
#471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thanks for the PR! I was looking at it and it looks good, I would add only a few comments. Also we should add unit test or perhaps ideally extend WebSocket example in the Seed repo to use also method |
Note: The latest |
HI Martin, You were right, using read_as_bytes from gloo is much better approach and works just fine on every browser tested by me (Chrome, Firefox, Safari and Opera). I have also extended the I'm having trouble with implementing tests for this function, because I have no idea how to convert js_sys::Uint8Array to JsValue and create a blob directly in rust. |
Nice, thanks! I'll check how it works on Windows and try to do some quick review.
Does |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good, works good :) I've added some short comments. And please update CHANGELOG.md.
src/browser/web_socket.rs
Outdated
@@ -50,6 +51,7 @@ pub enum WebSocketError { | |||
SendError(JsValue), | |||
SerdeError(serde_json::Error), | |||
PromiseError(JsValue), | |||
FileRedaerError(FileReadError), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo
Ok, I've corrected the typo, added changelog entry and unit test to check if obtaining bytes really work. |
This PR replaces the
Blob:array_buffer
usage with the FileReader. This change fixes #470.This is my first PR to seed, and the first time that I had anything to do with wasm_bindgen so I would really appreciate a review.