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

Better naming for websockets implementation

This commit is contained in:
Nikolay Kim
2018-03-02 11:29:55 -08:00
parent b640b49b05
commit 3b2928a391
12 changed files with 168 additions and 134 deletions

View File

@ -12,7 +12,7 @@ use std::time::Duration;
use actix::*;
use futures::Future;
use actix_web::ws::{Message, WsError, WsClient, WsClientWriter};
use actix_web::ws::{Message, ProtocolError, Client, ClientWriter};
fn main() {
@ -21,7 +21,7 @@ fn main() {
let sys = actix::System::new("ws-example");
Arbiter::handle().spawn(
WsClient::new("http://127.0.0.1:8080/ws/")
Client::new("http://127.0.0.1:8080/ws/")
.connect()
.map_err(|e| {
println!("Error: {}", e);
@ -53,7 +53,7 @@ fn main() {
}
struct ChatClient(WsClientWriter);
struct ChatClient(ClientWriter);
#[derive(Message)]
struct ClientCommand(String);
@ -93,7 +93,7 @@ impl Handler<ClientCommand> for ChatClient {
}
/// Handle server websocket messages
impl StreamHandler<Message, WsError> for ChatClient {
impl StreamHandler<Message, ProtocolError> for ChatClient {
fn handle(&mut self, msg: Message, ctx: &mut Context<Self>) {
match msg {

View File

@ -25,7 +25,7 @@ impl Actor for MyWebSocket {
}
/// Handler for `ws::Message`
impl StreamHandler<ws::Message, ws::WsError> for MyWebSocket {
impl StreamHandler<ws::Message, ws::ProtocolError> for MyWebSocket {
fn handle(&mut self, msg: ws::Message, ctx: &mut Self::Context) {
// process websocket messages