1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#![warn(missing_docs)]
#![cfg_attr(all(test, feature = "nightly"), feature(test))]
#![cfg_attr(
feature = "cargo-clippy",
allow(
renamed_and_removed_lints,
write_with_newline,
type_complexity,
match_ref_pats
)
)]
#![deny(unused_mut)]
#[cfg(feature = "async")]
extern crate bytes;
#[cfg(feature = "async")]
pub extern crate futures;
extern crate hyper;
#[cfg(any(feature = "sync-ssl", feature = "async-ssl"))]
extern crate native_tls;
#[cfg(test)]
extern crate tokio;
#[cfg(feature = "async")]
extern crate tokio_codec;
#[cfg(feature = "async")]
extern crate tokio_io;
#[cfg(feature = "async")]
extern crate tokio_reactor;
#[cfg(feature = "async")]
extern crate tokio_tcp;
#[cfg(feature = "async-ssl")]
extern crate tokio_tls;
extern crate unicase;
pub extern crate url;
pub extern crate websocket_base;
#[cfg(all(feature = "nightly", test))]
extern crate test;
macro_rules! upsert_header {
($headers:expr; $header:ty; { Some($pat:pat) => $some_match:expr,None => $default:expr }) => {{
if $headers.has::<$header>() {
if let Some($pat) = $headers.get_mut::<$header>() {
$some_match
}
} else {
$headers.set($default);
}
}};
}
pub use websocket_base::dataframe;
pub mod header;
pub use websocket_base::message;
pub mod result;
pub use websocket_base::ws;
#[cfg(feature = "async")]
pub mod codec;
#[cfg(feature = "sync")]
pub mod receiver;
#[cfg(feature = "sync")]
pub mod sender;
pub mod client;
pub mod server;
pub use websocket_base::stream;
#[cfg(feature = "sync")]
pub mod sync {
pub use sender;
pub use sender::Writer;
pub use receiver;
pub use receiver::Reader;
pub use stream::sync as stream;
pub use stream::sync::Stream;
pub mod server {
pub use server::sync::*;
pub use server::upgrade::sync as upgrade;
pub use server::upgrade::sync::IntoWs;
pub use server::upgrade::sync::Upgrade;
}
pub use server::sync::Server;
pub mod client {
pub use client::builder::ClientBuilder;
pub use client::sync::*;
}
pub use client::sync::Client;
}
#[cfg(feature = "async")]
pub mod async {
pub use codec;
pub use codec::http::HttpClientCodec;
pub use codec::http::HttpServerCodec;
pub use codec::ws::Context as MsgCodecCtx;
pub use codec::ws::MessageCodec;
pub use stream::async as stream;
pub use stream::async::Stream;
pub mod server {
pub use server::async::*;
pub use server::upgrade::async as upgrade;
pub use server::upgrade::async::IntoWs;
pub use server::upgrade::async::Upgrade;
}
pub use server::async::Server;
pub mod client {
pub use client::async::*;
pub use client::builder::ClientBuilder;
}
pub use client::async::Client;
pub use result::async::WebSocketFuture;
pub use futures;
pub use tokio_reactor::Handle;
pub use tokio_tcp::TcpListener;
pub use tokio_tcp::TcpStream;
}
pub use self::client::builder::ClientBuilder;
pub use self::message::CloseData;
pub use self::message::Message;
pub use self::message::OwnedMessage;
pub use self::result::WebSocketError;
pub use self::result::WebSocketResult;