This commit is contained in:
ntr 2019-07-26 00:17:45 +10:00
parent 86d77d23bb
commit 8adcd08daf

View File

@ -32,6 +32,11 @@ struct Connection {
impl Handler for Connection { impl Handler for Connection {
fn on_open(&mut self, _: ws::Handshake) -> ws::Result<()> { fn on_open(&mut self, _: ws::Handshake) -> ws::Result<()> {
info!("connected account={:?}", self.account); info!("connected account={:?}", self.account);
if let Some(ref a) = self.account {
self.ws.send(RpcMessage::AccountState(a.clone())).unwrap();
}
Ok(()) Ok(())
} }
@ -104,7 +109,10 @@ pub fn start(pool: PgPool, events: Events) {
let response = to_vec(&n).unwrap(); let response = to_vec(&n).unwrap();
out.send(Message::Binary(response)).unwrap(); out.send(Message::Binary(response)).unwrap();
} }
Err(_) => (), // we done
Err(_e) => {
break;
},
}; };
} }
}); });