mirror of
https://github.com/actix/examples
synced 2024-11-23 14:31:07 +01:00
update to alpha2
This commit is contained in:
parent
26f7c40d5e
commit
9a80911b92
@ -21,18 +21,18 @@ members = [
|
||||
"protobuf",
|
||||
"r2d2",
|
||||
"redis-session",
|
||||
"simple-auth-server",
|
||||
"rustls",
|
||||
#"simple-auth-server",
|
||||
"state",
|
||||
"static_index",
|
||||
"template_askama",
|
||||
"template_tera",
|
||||
"template_yarte",
|
||||
"tls",
|
||||
"rustls",
|
||||
"unix-socket",
|
||||
#"unix-socket",
|
||||
"web-cors/backend",
|
||||
"websocket",
|
||||
"websocket-chat",
|
||||
"websocket-chat-broker",
|
||||
#"websocket-chat-broker",
|
||||
"websocket-tcp-chat",
|
||||
]
|
||||
|
@ -7,7 +7,7 @@ workspace = ".."
|
||||
|
||||
[dependencies]
|
||||
actix = "0.8.0-alpha.2"
|
||||
actix-web = "1.0.0-alpha.1"
|
||||
actix-web = "1.0.0-alpha.2"
|
||||
actix-redis = { git="https://github.com/actix/actix-redis.git" }
|
||||
futures = "0.1.23"
|
||||
redis-async = "0.4.0"
|
||||
|
@ -6,9 +6,9 @@ workspace = ".."
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
actix-web = "1.0.0-alpha.1"
|
||||
actix-web = "1.0.0-alpha.2"
|
||||
actix-files = "0.1.0-alpha.1"
|
||||
actix-session = "0.1.0-alpha.1"
|
||||
actix-session = "0.1.0-alpha.2"
|
||||
dotenv = "0.13.0"
|
||||
env_logger = "0.5.10"
|
||||
futures = "0.1.22"
|
||||
|
@ -7,7 +7,7 @@ workspace = ".."
|
||||
|
||||
[dependencies]
|
||||
actix-rt = "0.2"
|
||||
actix-web = "1.0.0-alpha.1"
|
||||
actix-web = "1.0.0-alpha.2"
|
||||
|
||||
dotenv = "0.10"
|
||||
env_logger = "0.5"
|
||||
|
@ -7,7 +7,7 @@ workspace = ".."
|
||||
|
||||
[dependencies]
|
||||
actix-rt = "0.2"
|
||||
actix-web = { version="1.0.0-alpha.1", features=["ssl"] }
|
||||
actix-web = { version="1.0.0-alpha.2", features=["ssl"] }
|
||||
|
||||
futures = "0.1"
|
||||
serde = "1.0.43"
|
||||
|
@ -7,9 +7,9 @@ edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
actix-rt = "0.2"
|
||||
actix-web = "1.0.0-alpha.1"
|
||||
actix-web = "1.0.0-alpha.2"
|
||||
actix-files = "0.1.0-alpha.1"
|
||||
actix-session = "0.1.0-alpha.1"
|
||||
actix-session = "0.1.0-alpha.2"
|
||||
|
||||
futures = "0.1.25"
|
||||
env_logger = "0.5"
|
||||
|
@ -6,5 +6,5 @@ edition = "2018"
|
||||
workspace = ".."
|
||||
|
||||
[dependencies]
|
||||
actix-web = "1.0.0-alpha.1"
|
||||
actix-web = "1.0.0-alpha.2"
|
||||
env_logger = "0.6"
|
||||
|
@ -6,8 +6,8 @@ workspace = ".."
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
actix-web = "1.0.0-alpha.1"
|
||||
actix-session = "0.1.0-alpha.1"
|
||||
actix-web = "1.0.0-alpha.2"
|
||||
actix-session = "0.1.0-alpha.2"
|
||||
|
||||
futures = "0.1"
|
||||
time = "0.1"
|
||||
|
@ -6,7 +6,7 @@ workspace = ".."
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
actix-web = "1.0.0-alpha.1"
|
||||
actix-web = "1.0.0-alpha.2"
|
||||
|
||||
bytes = "0.4"
|
||||
env_logger = "0.6"
|
||||
|
@ -6,7 +6,7 @@ edition = "2018"
|
||||
workspace = ".."
|
||||
|
||||
[dependencies]
|
||||
actix-web = "1.0.0-alpha.1"
|
||||
actix-web = "1.0.0-alpha.2"
|
||||
|
||||
derive_more = "0.14.0"
|
||||
futures = "0.1.23"
|
||||
|
@ -6,7 +6,7 @@ edition = "2018"
|
||||
workspace = ".."
|
||||
|
||||
[dependencies]
|
||||
actix-web = "1.0.0-alpha.1"
|
||||
actix-web = "1.0.0-alpha.2"
|
||||
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
|
@ -6,5 +6,5 @@ workspace = ".."
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
actix-web = "1.0.0-alpha.1"
|
||||
actix-web = "1.0.0-alpha.2"
|
||||
env_logger = "0.6"
|
||||
|
@ -7,7 +7,7 @@ edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
actix-rt = "0.2"
|
||||
actix-web = "1.0.0-alpha.1"
|
||||
actix-web = "1.0.0-alpha.2"
|
||||
|
||||
clap = "2.32.0"
|
||||
futures = "0.1.25"
|
||||
|
@ -15,7 +15,7 @@ path = "src/server.rs"
|
||||
|
||||
[dependencies]
|
||||
actix-rt = "0.2"
|
||||
actix-web = "1.0.0-alpha.1"
|
||||
actix-web = "1.0.0-alpha.2"
|
||||
|
||||
env_logger = "0.5"
|
||||
futures = "0.1"
|
||||
|
@ -6,7 +6,7 @@ workspace = ".."
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
actix-web = "1.0.0-alpha.1"
|
||||
actix-web = "1.0.0-alpha.2"
|
||||
|
||||
bytes = "0.4"
|
||||
futures = "0.1"
|
||||
|
@ -6,7 +6,7 @@ workspace = ".."
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
actix-web = "1.0.0-alpha.1"
|
||||
actix-web = "1.0.0-alpha.2"
|
||||
env_logger = "0.6"
|
||||
futures = "0.1"
|
||||
serde = "1.0"
|
||||
|
@ -7,6 +7,6 @@ workspace = ".."
|
||||
|
||||
[dependencies]
|
||||
actix-service = "0.3.3"
|
||||
actix-web = "1.0.0-alpha.1"
|
||||
actix-web = "1.0.0-alpha.2"
|
||||
futures = "0.1.25"
|
||||
env_logger = "0.6"
|
@ -10,8 +10,7 @@ name = "multipart"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
#actix-web = "1.0.0-alpha.1"
|
||||
actix-web = { git="https://github.com/actix/actix-web.git" }
|
||||
actix-web = "1.0.0-alpha.2"
|
||||
|
||||
env_logger = "0.6"
|
||||
futures = "0.1.25"
|
||||
|
@ -2,16 +2,15 @@
|
||||
name = "protobuf-example"
|
||||
version = "0.1.0"
|
||||
authors = ["kingxsp <jin_hb_zh@126.com>"]
|
||||
workspace = "../"
|
||||
workspace = ".."
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
bytes = "0.4"
|
||||
futures = "0.1"
|
||||
failure = "0.1"
|
||||
env_logger = "*"
|
||||
|
||||
env_logger = "0.6"
|
||||
derive_more = "0.14"
|
||||
prost = "0.2.0"
|
||||
prost-derive = "0.2.0"
|
||||
|
||||
actix = "0.7"
|
||||
actix-web = "0.7"
|
||||
actix-web = "1.0.0-alpha.2"
|
||||
|
@ -1,19 +1,8 @@
|
||||
extern crate actix;
|
||||
extern crate actix_web;
|
||||
extern crate bytes;
|
||||
extern crate futures;
|
||||
#[macro_use]
|
||||
extern crate failure;
|
||||
extern crate env_logger;
|
||||
extern crate prost;
|
||||
#[macro_use]
|
||||
extern crate prost_derive;
|
||||
|
||||
use actix_web::{
|
||||
http, middleware, server, App, AsyncResponder, Error, HttpRequest, HttpResponse,
|
||||
};
|
||||
use actix_web::{middleware, web, App, Error, HttpResponse, HttpServer};
|
||||
use futures::Future;
|
||||
|
||||
mod protobuf;
|
||||
use protobuf::ProtoBufResponseBuilder;
|
||||
|
||||
@ -26,31 +15,24 @@ pub struct MyObj {
|
||||
}
|
||||
|
||||
/// This handler uses `ProtoBufMessage` for loading protobuf object.
|
||||
fn index(req: &HttpRequest) -> Box<Future<Item = HttpResponse, Error = Error>> {
|
||||
protobuf::ProtoBufMessage::new(req)
|
||||
fn index(pl: web::Payload) -> impl Future<Item = HttpResponse, Error = Error> {
|
||||
protobuf::ProtoBufMessage::new(pl)
|
||||
.from_err() // convert all errors into `Error`
|
||||
.and_then(|val: MyObj| {
|
||||
println!("model: {:?}", val);
|
||||
Ok(HttpResponse::Ok().protobuf(val)?) // <- send response
|
||||
})
|
||||
.responder()
|
||||
}
|
||||
|
||||
fn main() {
|
||||
::std::env::set_var("RUST_LOG", "actix_web=info");
|
||||
fn main() -> std::io::Result<()> {
|
||||
std::env::set_var("RUST_LOG", "actix_web=info,actix_server=info");
|
||||
env_logger::init();
|
||||
let sys = actix::System::new("protobuf-example");
|
||||
|
||||
server::new(|| {
|
||||
HttpServer::new(|| {
|
||||
App::new()
|
||||
.middleware(middleware::Logger::default())
|
||||
.resource("/", |r| r.method(http::Method::POST).f(index))
|
||||
.wrap(middleware::Logger::default())
|
||||
.service(web::resource("/").route(web::post().to_async(index)))
|
||||
})
|
||||
.bind("127.0.0.1:8080")
|
||||
.unwrap()
|
||||
.shutdown_timeout(1)
|
||||
.start();
|
||||
|
||||
println!("Started http server: 127.0.0.1:8080");
|
||||
let _ = sys.run();
|
||||
.bind("127.0.0.1:8080")?
|
||||
.run()
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
use bytes::BytesMut;
|
||||
use futures::{Future, Poll, Stream};
|
||||
|
||||
use bytes::IntoBuf;
|
||||
use bytes::{Bytes, IntoBuf};
|
||||
use derive_more::{Display, From};
|
||||
use prost::DecodeError as ProtoBufDecodeError;
|
||||
use prost::EncodeError as ProtoBufEncodeError;
|
||||
use prost::Message;
|
||||
@ -9,25 +10,25 @@ use prost::Message;
|
||||
use actix_web::dev::HttpResponseBuilder;
|
||||
use actix_web::error::{Error, PayloadError, ResponseError};
|
||||
use actix_web::http::header::CONTENT_TYPE;
|
||||
use actix_web::{HttpMessage, HttpRequest, HttpResponse, Responder};
|
||||
use actix_web::{HttpRequest, HttpResponse, Responder};
|
||||
|
||||
#[derive(Fail, Debug)]
|
||||
#[derive(Debug, Display, From)]
|
||||
pub enum ProtoBufPayloadError {
|
||||
/// Payload size is bigger than 256k
|
||||
#[fail(display = "Payload size is bigger than 256k")]
|
||||
#[display(fmt = "Payload size is bigger than 256k")]
|
||||
Overflow,
|
||||
/// Content type error
|
||||
#[fail(display = "Content type error")]
|
||||
#[display(fmt = "Content type error")]
|
||||
ContentType,
|
||||
/// Serialize error
|
||||
#[fail(display = "ProtoBud serialize error: {}", _0)]
|
||||
Serialize(#[cause] ProtoBufEncodeError),
|
||||
#[display(fmt = "ProtoBud serialize error: {}", _0)]
|
||||
Serialize(ProtoBufEncodeError),
|
||||
/// Deserialize error
|
||||
#[fail(display = "ProtoBud deserialize error: {}", _0)]
|
||||
Deserialize(#[cause] ProtoBufDecodeError),
|
||||
#[display(fmt = "ProtoBud deserialize error: {}", _0)]
|
||||
Deserialize(ProtoBufDecodeError),
|
||||
/// Payload error
|
||||
#[fail(display = "Error that occur during reading payload: {}", _0)]
|
||||
Payload(#[cause] PayloadError),
|
||||
#[display(fmt = "Error that occur during reading payload: {}", _0)]
|
||||
Payload(PayloadError),
|
||||
}
|
||||
|
||||
impl ResponseError for ProtoBufPayloadError {
|
||||
@ -39,26 +40,14 @@ impl ResponseError for ProtoBufPayloadError {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<PayloadError> for ProtoBufPayloadError {
|
||||
fn from(err: PayloadError) -> ProtoBufPayloadError {
|
||||
ProtoBufPayloadError::Payload(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ProtoBufDecodeError> for ProtoBufPayloadError {
|
||||
fn from(err: ProtoBufDecodeError) -> ProtoBufPayloadError {
|
||||
ProtoBufPayloadError::Deserialize(err)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ProtoBuf<T: Message>(pub T);
|
||||
|
||||
impl<T: Message> Responder for ProtoBuf<T> {
|
||||
type Item = HttpResponse;
|
||||
type Error = Error;
|
||||
type Future = Result<HttpResponse, Error>;
|
||||
|
||||
fn respond_to<S>(self, _: &HttpRequest<S>) -> Result<HttpResponse, Error> {
|
||||
fn respond_to(self, _: &HttpRequest) -> Result<HttpResponse, Error> {
|
||||
let mut buf = Vec::new();
|
||||
self.0
|
||||
.encode(&mut buf)
|
||||
@ -78,9 +67,11 @@ pub struct ProtoBufMessage<U: Message + Default> {
|
||||
|
||||
impl<U: Message + Default + 'static> ProtoBufMessage<U> {
|
||||
/// Create `ProtoBufMessage` for request.
|
||||
pub fn new(req: &HttpRequest) -> Self {
|
||||
let fut = req
|
||||
.payload()
|
||||
pub fn new<S>(pl: S) -> Self
|
||||
where
|
||||
S: Stream<Item = Bytes, Error = PayloadError> + 'static,
|
||||
{
|
||||
let fut = pl
|
||||
.map_err(|e| ProtoBufPayloadError::Payload(e))
|
||||
.fold(BytesMut::new(), move |mut body, chunk| {
|
||||
body.extend_from_slice(&chunk);
|
||||
|
@ -7,7 +7,7 @@ workspace = ".."
|
||||
|
||||
[dependencies]
|
||||
actix-rt = "0.2"
|
||||
actix-web = "1.0.0-alpha.1"
|
||||
actix-web = "1.0.0-alpha.2"
|
||||
|
||||
futures = "0.1"
|
||||
env_logger = "0.6"
|
||||
|
@ -7,7 +7,7 @@ edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
actix = "0.8.0-alpha.2"
|
||||
actix-web = "1.0.0-alpha.1"
|
||||
actix-session = "0.1.0-alpha.1"
|
||||
actix-web = "1.0.0-alpha.2"
|
||||
actix-session = "0.1.0-alpha.2"
|
||||
actix-redis = { git = "https://github.com/actix/actix-redis.git", features = ["web"] }
|
||||
env_logger = "0.6"
|
||||
|
@ -2,7 +2,8 @@
|
||||
name = "rustls-example"
|
||||
version = "0.1.0"
|
||||
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
||||
workspace = "../"
|
||||
workspace = ".."
|
||||
edition = "2018"
|
||||
|
||||
[[bin]]
|
||||
name = "rustls-server"
|
||||
@ -10,6 +11,6 @@ path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
env_logger = "0.5"
|
||||
rustls = "0.14"
|
||||
actix = "0.7"
|
||||
actix-web = { version = "0.7", features=["rust-tls"] }
|
||||
rustls = "0.15"
|
||||
actix-web = { version = "1.0.0-alpha.2", features=["rust-tls"] }
|
||||
actix-files = "0.1.0-alpha.1"
|
||||
|
@ -1,32 +1,24 @@
|
||||
extern crate actix;
|
||||
extern crate actix_web;
|
||||
extern crate env_logger;
|
||||
extern crate rustls;
|
||||
|
||||
use std::fs::File;
|
||||
use std::io::BufReader;
|
||||
|
||||
use actix_web::{http, middleware, server, App, Error, HttpRequest, HttpResponse};
|
||||
use actix_files::Files;
|
||||
use actix_web::{middleware, web, App, Error, HttpRequest, HttpResponse, HttpServer};
|
||||
use rustls::internal::pemfile::{certs, rsa_private_keys};
|
||||
use rustls::{NoClientAuth, ServerConfig};
|
||||
use server::ServerFlags;
|
||||
|
||||
use actix_web::fs::StaticFiles;
|
||||
|
||||
/// simple handle
|
||||
fn index(req: &HttpRequest) -> Result<HttpResponse, Error> {
|
||||
fn index(req: HttpRequest) -> Result<HttpResponse, Error> {
|
||||
println!("{:?}", req);
|
||||
Ok(HttpResponse::Ok()
|
||||
.content_type("text/plain")
|
||||
.body("Welcome!"))
|
||||
}
|
||||
|
||||
fn main() {
|
||||
if ::std::env::var("RUST_LOG").is_err() {
|
||||
::std::env::set_var("RUST_LOG", "actix_web=info");
|
||||
fn main() -> std::io::Result<()> {
|
||||
if std::env::var("RUST_LOG").is_err() {
|
||||
std::env::set_var("RUST_LOG", "actix_web=info");
|
||||
}
|
||||
env_logger::init();
|
||||
let sys = actix::System::new("ws-example");
|
||||
|
||||
// load ssl keys
|
||||
let mut config = ServerConfig::new(NoClientAuth::new());
|
||||
@ -36,32 +28,20 @@ fn main() {
|
||||
let mut keys = rsa_private_keys(key_file).unwrap();
|
||||
config.set_single_cert(cert_chain, keys.remove(0)).unwrap();
|
||||
|
||||
// actix acceptor
|
||||
let acceptor = server::RustlsAcceptor::with_flags(
|
||||
config,
|
||||
ServerFlags::HTTP1 | ServerFlags::HTTP2,
|
||||
);
|
||||
|
||||
server::new(|| {
|
||||
HttpServer::new(|| {
|
||||
App::new()
|
||||
// enable logger
|
||||
.middleware(middleware::Logger::default())
|
||||
.wrap(middleware::Logger::default())
|
||||
// register simple handler, handle all methods
|
||||
.resource("/index.html", |r| r.f(index))
|
||||
.service(web::resource("/index.html").to(index))
|
||||
// with path parameters
|
||||
.resource("/", |r| {
|
||||
r.method(http::Method::GET).f(|_| {
|
||||
HttpResponse::Found()
|
||||
.header("LOCATION", "/index.html")
|
||||
.finish()
|
||||
})
|
||||
})
|
||||
.handler("/static", StaticFiles::new("static").unwrap())
|
||||
.service(web::resource("/").route(web::get().to(|| {
|
||||
HttpResponse::Found()
|
||||
.header("LOCATION", "/index.html")
|
||||
.finish()
|
||||
})))
|
||||
.service(Files::new("/static", "static"))
|
||||
})
|
||||
.bind_with("127.0.0.1:8443", move || acceptor.clone())
|
||||
.unwrap()
|
||||
.start();
|
||||
|
||||
println!("Started http server: 127.0.0.1:8443");
|
||||
let _ = sys.run();
|
||||
.bind_rustls("127.0.0.1:8443", config)?
|
||||
.run()
|
||||
}
|
||||
|
@ -7,7 +7,8 @@ workspace = ".."
|
||||
|
||||
[dependencies]
|
||||
actix = { version = "0.8.0-alpha.2", features = ["http"] }
|
||||
actix-web = "1.0.0-alpha.1"
|
||||
actix-rt = "0.2.2"
|
||||
actix-web = "1.0.0-alpha.2"
|
||||
actix-files = "0.1.0-alpha.1"
|
||||
|
||||
bcrypt = "0.2.1"
|
||||
|
@ -37,6 +37,7 @@ fn main() -> std::io::Result<()> {
|
||||
"simple-auth-server=debug,actix_web=info,actix_server=info",
|
||||
);
|
||||
env_logger::init();
|
||||
let sys = actix_rt::System::new("example");
|
||||
|
||||
let database_url = std::env::var("DATABASE_URL").expect("DATABASE_URL must be set");
|
||||
|
||||
@ -93,5 +94,7 @@ fn main() -> std::io::Result<()> {
|
||||
.service(fs::Files::new("/", "./static/").index_file("index.html"))
|
||||
})
|
||||
.bind("127.0.0.1:3000")?
|
||||
.run()
|
||||
.start();
|
||||
|
||||
sys.run()
|
||||
}
|
||||
|
@ -6,6 +6,6 @@ workspace = ".."
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
actix-web = "1.0.0-alpha.1"
|
||||
actix-web = "1.0.0-alpha.2"
|
||||
futures = "0.1.25"
|
||||
env_logger = "0.6"
|
||||
|
@ -9,5 +9,5 @@ edition = "2018"
|
||||
futures = "0.1"
|
||||
env_logger = "0.5"
|
||||
|
||||
actix-web = "1.0.0-alpha.1"
|
||||
actix-web = "1.0.0-alpha.2"
|
||||
actix-files = "0.1.0-alpha.1"
|
||||
|
@ -7,7 +7,7 @@ edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
#askama = { version = "0.8", features = ["with-actix-web"] }
|
||||
actix-web = "1.0.0-alpha.1"
|
||||
actix-web = "1.0.0-alpha.2"
|
||||
env_logger = "0.6"
|
||||
askama = "0.8"
|
||||
|
||||
|
@ -8,4 +8,4 @@ edition = "2018"
|
||||
[dependencies]
|
||||
env_logger = "0.6"
|
||||
tera = "0.11"
|
||||
actix-web = "1.0.0-alpha.1"
|
||||
actix-web = "1.0.0-alpha.2"
|
||||
|
@ -7,7 +7,7 @@ edition = "2018"
|
||||
workspace = ".."
|
||||
|
||||
[dependencies]
|
||||
actix-web = "1.0.0-alpha.1"
|
||||
actix-web = "1.0.0-alpha.2"
|
||||
env_logger = "0.6"
|
||||
yarte = "0.1"
|
||||
|
||||
|
@ -11,6 +11,6 @@ path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
actix-rt = "0.2"
|
||||
actix-web = { version="1.0.0-alpha.1", features=["ssl"] }
|
||||
actix-web = { version="1.0.0-alpha.2", features=["ssl"] }
|
||||
env_logger = "0.6"
|
||||
openssl = { version="0.10" }
|
||||
|
@ -6,7 +6,7 @@ workspace = "../../"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
actix-web = "1.0.0-alpha.1"
|
||||
actix-web = "1.0.0-alpha.2"
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
serde_json = "1.0"
|
||||
|
@ -11,8 +11,8 @@ path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
actix = "0.8.0-alpha.2"
|
||||
actix-web = "1.0.0-alpha.1"
|
||||
actix-web-actors = "1.0.0-alpha.1"
|
||||
actix-web = "1.0.0-alpha.2"
|
||||
actix-web-actors = "1.0.0-alpha.2"
|
||||
actix-files = "0.1.0-alpha.1"
|
||||
|
||||
rand = "0.6"
|
||||
|
@ -173,6 +173,7 @@ impl StreamHandler<ws::Message, ws::ProtocolError> for WsChatSession {
|
||||
ws::Message::Close(_) => {
|
||||
ctx.stop();
|
||||
}
|
||||
ws::Message::Nop => (),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,8 +15,8 @@ path = "src/client.rs"
|
||||
|
||||
[dependencies]
|
||||
actix = "0.8.0-alpha.2"
|
||||
actix-web = "1.0.0-alpha.1"
|
||||
actix-web-actors = "1.0.0-alpha.1"
|
||||
actix-web = "1.0.0-alpha.2"
|
||||
actix-web-actors = "1.0.0-alpha.2"
|
||||
actix-files = "0.1.0-alpha.1"
|
||||
|
||||
rand = "0.6"
|
||||
|
@ -180,6 +180,7 @@ impl StreamHandler<ws::Message, ws::ProtocolError> for WsChatSession {
|
||||
ws::Message::Close(_) => {
|
||||
ctx.stop();
|
||||
}
|
||||
ws::Message::Nop => (),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,9 +14,9 @@ path = "src/main.rs"
|
||||
#path = "src/client.rs"
|
||||
|
||||
[dependencies]
|
||||
actix = "0.8.0-alpha.1"
|
||||
actix-web = "1.0.0-alpha.1"
|
||||
actix-web-actors = "1.0.0-alpha.1"
|
||||
actix = "0.8.0-alpha.2"
|
||||
actix-web = "1.0.0-alpha.2"
|
||||
actix-web-actors = "1.0.0-alpha.2"
|
||||
actix-files = "0.1.0-alpha.1"
|
||||
env_logger = "0.6"
|
||||
futures = "0.1"
|
||||
|
@ -58,6 +58,7 @@ impl StreamHandler<ws::Message, ws::ProtocolError> for MyWebSocket {
|
||||
ws::Message::Close(_) => {
|
||||
ctx.stop();
|
||||
}
|
||||
ws::Message::Nop => (),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user