Provide the basics for an EventBusClient #2

Manually merged
rtyler merged 12 commits from resource-allocation into master 2020-01-14 05:44:41 +00:00
1 changed files with 13 additions and 1 deletions
Showing only changes of commit 044abc397f - Show all commits

View File

@ -122,7 +122,19 @@ impl Handler<ClientCommand> for EventBusClient {
impl StreamHandler<Result<Frame, WsProtocolError>> for EventBusClient {
fn handle(&mut self, msg: Result<Frame, WsProtocolError>, _: &mut Context<Self>) {
if let Ok(Frame::Text(txt)) = msg {
info!("Server: {:?}", txt)
/*
* We have received _some_ message from the eventbus, let's try to
* decode it!
*/
let msg = serde_json::from_slice::<OutputMessage>(&txt);
match msg {
Ok(msg) => {
info!("Received valid message: {:?}", msg);
},
Err(e) => {
error!("Received invalid message: {}", e);
},
}
}
}