mirror of
https://github.com/actix/actix-extras.git
synced 2025-06-26 18:37:41 +02:00
sync with latest actix
This commit is contained in:
@ -5,7 +5,7 @@ use futures::unsync::oneshot;
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use actix::{Actor, ActorState, ActorContext, AsyncContext,
|
||||
Addr, Handler, ResponseType, SpawnHandle, MessageResult, Syn, Unsync};
|
||||
Addr, Handler, Message, Syn, Unsync, SpawnHandle};
|
||||
use actix::fut::ActorFuture;
|
||||
use actix::dev::{ContextImpl, ToEnvelope, RemoteEnvelope};
|
||||
|
||||
@ -219,9 +219,9 @@ impl<A, S> ActorHttpContext for WebsocketContext<A, S> where A: Actor<Context=Se
|
||||
|
||||
impl<A, M, S> ToEnvelope<Syn<A>, M> for WebsocketContext<A, S>
|
||||
where A: Actor<Context=WebsocketContext<A, S>> + Handler<M>,
|
||||
M: ResponseType + Send + 'static, M::Item: Send, M::Error: Send,
|
||||
M: Message + Send + 'static, M::Result: Send
|
||||
{
|
||||
fn pack(msg: M, tx: Option<Sender<MessageResult<M>>>) -> Syn<A> {
|
||||
fn pack(msg: M, tx: Option<Sender<M::Result>>) -> Syn<A> {
|
||||
Syn::new(Box::new(RemoteEnvelope::envelope(msg, tx)))
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ use bytes::BytesMut;
|
||||
use http::{Method, StatusCode, header};
|
||||
use futures::{Async, Poll, Stream};
|
||||
|
||||
use actix::{Actor, AsyncContext, ResponseType, Handler};
|
||||
use actix::{Actor, AsyncContext, Handler};
|
||||
|
||||
use body::Binary;
|
||||
use payload::ReadAny;
|
||||
@ -74,7 +74,7 @@ const SEC_WEBSOCKET_VERSION: &str = "SEC-WEBSOCKET-VERSION";
|
||||
|
||||
|
||||
/// `WebSocket` Message
|
||||
#[derive(Debug, PartialEq)]
|
||||
#[derive(Debug, PartialEq, Message)]
|
||||
pub enum Message {
|
||||
Text(String),
|
||||
Binary(Binary),
|
||||
@ -85,11 +85,6 @@ pub enum Message {
|
||||
Error
|
||||
}
|
||||
|
||||
impl ResponseType for Message {
|
||||
type Item = ();
|
||||
type Error = ();
|
||||
}
|
||||
|
||||
/// Do websocket handshake and start actor
|
||||
pub fn start<A, S>(mut req: HttpRequest<S>, actor: A) -> Result<HttpResponse, Error>
|
||||
where A: Actor<Context=WebsocketContext<A, S>> + Handler<Message>,
|
||||
|
Reference in New Issue
Block a user