Description
I can't seem to deserialise a binary websocket message into CBOR.
The message i'm sending is a struct converted to a vec using serde_cbor.
https://gist.github.com/margh/eb805124d55a0adba2b95ff1428fba76#file-ws_example-rs-L80
If this line is changed to JSON the message is parsed fine, but the response becomes an error, i assume because the binary data can't be serialized into json.
I noticed there's no string format macro in this file, perhaps that is the cause of the trait not being fulfilled?:
https://github.com/DenisKolodin/yew/blob/master/src/format/cbor.rs#L17
Please bear with my sketchy code, I'm not sure if i'm using the formatter correctly in this case.
Expected Results
Message is encoded into a CBOR value I can later cast to a struct.
Actual Results
error[E0277]: the trait bound `yew::format::Cbor<std::result::Result<WsResponse, failure::Error>>: std::convert::From<std::result::Result<std::string::String, failure::Error>>` is not satisfied
--> src/lib.rs:87:52
|
87 | let task = self.ws_service.connect("ws://localhost:40000/", callback, notification);
| ^^^^^^^ the trait `std::convert::From<std::result::Result<std::string::String, failure::Error>>` is not implemented for `yew::format::Cbor<std::result::Result<WsResponse, failure::Error>>`
|
= help: the following implementations were found:
<yew::format::Cbor<std::result::Result<T, failure::Error>> as std::convert::From<std::result::Result<std::vec::Vec<u8>, failure::Error>>>
Context (Environment)
- target: wasm32-unknown-unknown
Description
I can't seem to deserialise a binary websocket message into CBOR.
The message i'm sending is a struct converted to a vec using
serde_cbor.https://gist.github.com/margh/eb805124d55a0adba2b95ff1428fba76#file-ws_example-rs-L80
If this line is changed to JSON the message is parsed fine, but the response becomes an error, i assume because the binary data can't be serialized into json.
I noticed there's no string format macro in this file, perhaps that is the cause of the trait not being fulfilled?:
https://github.com/DenisKolodin/yew/blob/master/src/format/cbor.rs#L17
Please bear with my sketchy code, I'm not sure if i'm using the formatter correctly in this case.
Expected Results
Message is encoded into a CBOR value I can later cast to a struct.
Actual Results
Context (Environment)