Skip to content

WebsocketMessage.bytes() doesn't work on Safari #470

Closed
@tkubicz

Description

@tkubicz

Hello,

WebSocketMessage.bytes() function doesn't work on safari and throws a runtime exception. This problem doesn't exist in Chrome or Firefox.

[Error] wasm-bindgen: imported JS function that was not marked as `catch` threw an error: – "getObject(arg0).arrayBuffer is not a function. (In 'getObject(arg0).arrayBuffer()', 'getObject(arg0).arrayBuffer' is undefined)↵↵Stack…"
	(anonymous function) (package.js:224)
	wasm-stub
	<?>.wasm-function[web_sys::features::gen_Blob::Blob::array_buffer::h6035f6f3793b884c]
	<?>.wasm-function[seed::browser::web_socket::message::WebSocketMessage::bytes::{{closure}}::h4555098a4d829d6b]
	<?>.wasm-function[<std::future::GenFuture<T> as core::future::future::Future>::poll::h15af837ff880ad89]
	<?>.wasm-function[std::future::poll_with_tls_context::hecb607a7f8c88198]
	<?>.wasm-function[client::chat::update::{{closure}}::h747c3fe65ead2501]
	<?>.wasm-function[<std::future::GenFuture<T> as core::future::future::Future>::poll::hc29e47b33fd89f21]
	<?>.wasm-function[<futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll::h2a1c1f0aec3006e2]
	<?>.wasm-function[<futures_util::future::future::Map<Fut,F> as core::future::future::Future>::poll::h6dafe6092c28d87f]
	<?>.wasm-function[wasm_bindgen_futures::task::singlethread::Task::run::hd2ae8a7fce6033b4]
	<?>.wasm-function[wasm_bindgen_futures::queue::QueueState::run_all::h4f7092ed55373ca7]
	<?>.wasm-function[wasm_bindgen_futures::queue::Queue::new::{{closure}}::hb67de4d16789d1b1]
	<?>.wasm-function[<dyn core::ops::function::FnMut<(A,)>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::h727a037c3544a9ea]
	wasm-stub
	_dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h727a037c3544a9ea
	__wbg_adapter_31 (package.js:273:135)
	real (package.js:249)
	promiseReactionJob

Function bytes()(message.rs) at line 52 uses blob.array_buffer() which is currently not supported by safari.
The quick fix for this issue would be to use FileReader.readAsArrayBuffer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions