January 2019
Intermediate to advanced
520 pages
14h 32m
English
The notification actor is more complex and we need more types to implement it. Let's look into them:
use actix::{Actor, ActorContext, AsyncContext, Handler, Recipient, StreamHandler};use actix_web::ws::{Message, ProtocolError, WebsocketContext};use crate::repeater::{RepeaterControl, RepeaterUpdate};use std::time::{Duration, Instant};use super::State;
First, we started by using the ws module of the actix_web crate. It contains a necessary WebsocketContext that we will use as a context value in the Actor trait implementation. Also, we need Message and ProtocolError types to implement WebSocket stream handling. We also imported ActorContext to stop the method of the Context instance to break the connection with a client. We imported the ...
Read now
Unlock full access