1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-06-25 09:59:21 +02:00

add simple websocket example

This commit is contained in:
Nikolay Kim
2017-10-20 21:08:38 -07:00
parent 9fd84a0aef
commit 71dc9edf8e
7 changed files with 181 additions and 36 deletions

View File

@ -148,11 +148,11 @@ pub struct HttpChannel<T: 'static, A: 'static> {
keepalive_timer: Option<Timeout>,
}
impl<T: 'static, A: 'static> Drop for HttpChannel<T, A> {
/*impl<T: 'static, A: 'static> Drop for HttpChannel<T, A> {
fn drop(&mut self) {
println!("Drop http channel");
}
}
}*/
impl<T, A> Actor for HttpChannel<T, A>
where T: AsyncRead + AsyncWrite + 'static, A: 'static

View File

@ -129,7 +129,9 @@ impl StaticFiles {
impl<S: 'static> RouteHandler<S> for StaticFiles {
fn set_prefix(&mut self, prefix: String) {
self.prefix += &prefix;
if prefix != "/" {
self.prefix += &prefix;
}
}
fn handle(&self, req: HttpRequest, payload: Payload, state: Rc<S>) -> Task {

View File

@ -49,7 +49,7 @@
//! {
//! match msg {
//! ws::Message::Ping(msg) => ws::WsWriter::pong(ctx, msg),
//! ws::Message::Text(text) => ws::WsWriter::text(ctx, text),
//! ws::Message::Text(text) => ws::WsWriter::text(ctx, &text),
//! ws::Message::Binary(bin) => ws::WsWriter::binary(ctx, bin),
//! _ => (),
//! }