mirror of
https://github.com/mastodon/flodgatt
synced 2025-04-11 22:58:25 +02:00
Improve logging
Add more descriptive messages for the logging triggered by the websocket server.
This commit is contained in:
parent
7a0b11e240
commit
fffd3b6b4d
@ -15,18 +15,26 @@ impl Actor for WebsocketActor {
|
|||||||
/// Handler for ws::Message message
|
/// Handler for ws::Message message
|
||||||
impl StreamHandler<ws::Message, ws::ProtocolError> for WebsocketActor {
|
impl StreamHandler<ws::Message, ws::ProtocolError> for WebsocketActor {
|
||||||
fn started(&mut self, ctx: &mut Self::Context) {
|
fn started(&mut self, ctx: &mut Self::Context) {
|
||||||
ctx.run_interval(Duration::from_secs(HEARTBEAT_INTERVAL_SECONDS), |_, inner_ctx| {
|
ctx.run_interval(
|
||||||
inner_ctx.ping("");
|
Duration::from_secs(HEARTBEAT_INTERVAL_SECONDS),
|
||||||
});
|
|_, inner_ctx| {
|
||||||
|
inner_ctx.ping("Ping from StreamHandler");
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This appears to be an echo server based on the actix_web documentation
|
||||||
|
// We won't actually need echo functionality in the final server
|
||||||
fn handle(&mut self, msg: ws::Message, ctx: &mut Self::Context) {
|
fn handle(&mut self, msg: ws::Message, ctx: &mut Self::Context) {
|
||||||
debug!("Message {:?}", msg);
|
debug!("Message {:?}", msg);
|
||||||
|
|
||||||
let red = ctx.state().redis.send(Command(RespValue::SimpleString("GET".into())));
|
let red = ctx
|
||||||
|
.state()
|
||||||
|
.redis
|
||||||
|
.send(Command(RespValue::SimpleString("GET".into())));
|
||||||
|
|
||||||
match msg {
|
match msg {
|
||||||
ws::Message::Pong(msg) => debug!("{}", msg),
|
ws::Message::Pong(msg) => debug!("matched: {}", msg),
|
||||||
ws::Message::Text(text) => ctx.text(text),
|
ws::Message::Text(text) => ctx.text(text),
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user