diff --git a/Cargo.toml b/Cargo.toml index dd7dc5e64..316ba9ef3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -111,5 +111,6 @@ members = [ "examples/state", "examples/template_tera", "examples/tls", + "examples/websocket", "examples/websocket-chat", ] diff --git a/examples/websocket/src/main.rs b/examples/websocket/src/main.rs index 022ada344..dfd0d52c7 100644 --- a/examples/websocket/src/main.rs +++ b/examples/websocket/src/main.rs @@ -10,10 +10,11 @@ extern crate env_logger; use actix::*; use actix_web::*; -#[cfg(target_os = "linux")] use actix::actors::signal::{ProcessSignals, Subscribe}; +#[cfg(unix)] +use actix::actors::signal::{ProcessSignals, Subscribe}; /// do websocket handshake and start `MyWebSocket` actor -fn ws_index(r: HttpRequest) -> Result { +fn ws_index(r: HttpRequest) -> Result { ws::start(r, MyWebSocket) } @@ -73,7 +74,9 @@ fn main() { .bind("127.0.0.1:8080").unwrap() .start(); - if cfg!(target_os = "linux") { // Subscribe to unix signals + // Subscribe to unix signals + #[cfg(unix)] + { let signals = Arbiter::system_registry().get::(); signals.send(Subscribe(_addr.subscriber())); }