use re-expored tungstenite

pull/32/head
Cheng JIANG 5 years ago committed by Sebastian Dröge
parent 5c594c0549
commit 3d668b5b8f
  1. 6
      examples/autobahn-server.rs
  2. 2
      examples/client.rs
  3. 6
      examples/interval-server.rs
  4. 2
      examples/server.rs

@ -1,8 +1,10 @@
use async_std::net::{SocketAddr, TcpListener, TcpStream}; use async_std::net::{SocketAddr, TcpListener, TcpStream};
use async_tungstenite::{accept_async, tungstenite::Error}; use async_tungstenite::{
accept_async,
tungstenite::{Error, Result},
};
use futures::prelude::*; use futures::prelude::*;
use log::*; use log::*;
use tungstenite::Result;
async fn accept_connection(peer: SocketAddr, stream: TcpStream) { async fn accept_connection(peer: SocketAddr, stream: TcpStream) {
if let Err(e) = handle_connection(peer, stream).await { if let Err(e) = handle_connection(peer, stream).await {

@ -13,12 +13,12 @@
use std::env; use std::env;
use futures::{future, pin_mut, StreamExt}; use futures::{future, pin_mut, StreamExt};
use tungstenite::protocol::Message;
use async_std::io; use async_std::io;
use async_std::prelude::*; use async_std::prelude::*;
use async_std::task; use async_std::task;
use async_tungstenite::async_std::connect_async; use async_tungstenite::async_std::connect_async;
use async_tungstenite::tungstenite::protocol::Message;
async fn run() { async fn run() {
let connect_addr = env::args() let connect_addr = env::args()

@ -1,12 +1,14 @@
use async_std::net::{TcpListener, TcpStream}; use async_std::net::{TcpListener, TcpStream};
use async_std::task; use async_std::task;
use async_tungstenite::{accept_async, tungstenite::Error}; use async_tungstenite::{
accept_async,
tungstenite::{Error, Message, Result},
};
use futures::future::{select, Either}; use futures::future::{select, Either};
use futures::prelude::*; use futures::prelude::*;
use log::*; use log::*;
use std::net::SocketAddr; use std::net::SocketAddr;
use std::time::Duration; use std::time::Duration;
use tungstenite::{Message, Result};
async fn accept_connection(peer: SocketAddr, stream: TcpStream) { async fn accept_connection(peer: SocketAddr, stream: TcpStream) {
if let Err(e) = handle_connection(peer, stream).await { if let Err(e) = handle_connection(peer, stream).await {

@ -33,7 +33,7 @@ use futures::{
use async_std::net::{TcpListener, TcpStream}; use async_std::net::{TcpListener, TcpStream};
use async_std::task; use async_std::task;
use tungstenite::protocol::Message; use async_tungstenite::tungstenite::protocol::Message;
type Tx = UnboundedSender<Message>; type Tx = UnboundedSender<Message>;
type PeerMap = Arc<Mutex<HashMap<SocketAddr, Tx>>>; type PeerMap = Arc<Mutex<HashMap<SocketAddr, Tx>>>;

Loading…
Cancel
Save