From 284b59722a429154bc18105ee77b888970dfe8e4 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Mon, 1 Jan 2018 09:31:42 -0800 Subject: [PATCH] update websocket example --- Cargo.toml | 1 + examples/websocket/src/main.rs | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) 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())); }