Sebastian Dröge
9b7f7a02c0
Use #[pin_project] in stream implementation to get rid of remaining unsafe code
...
Now the whole crate has no unsafe code left.
5 years ago
Sebastian Dröge
93d4b35d4d
Remove unused #[pin_project] attribute
5 years ago
Sebastian Dröge
9f3a1ee30b
Add proxy waiters to allow the Stream to trigger AsyncWrite operations
...
As a side effect also gets rid of unsafe code and raw pointers.
We have the problem that external read operations (i.e. the Stream impl)
can trigger both read (AsyncRead) and write (AsyncWrite) operations on
the underyling stream. At the same time write operations (i.e. the Sink
impl) can trigger write operations (AsyncWrite) too.
Both the Stream and the Sink can be used on two different tasks, but it
is required that AsyncRead and AsyncWrite are only ever used by a single
task (or better: with a single waker) at a time.
Doing otherwise would cause only the latest waker to be remembered, so
in our case either the Stream or the Sink impl would potentially wait
forever to be woken up because only the other one would've been woken
up.
To solve this we implement a waker proxy that has two slots (one for
read, one for write) to store wakers. One waker proxy is always passed
to the AsyncRead, the other to AsyncWrite so that they will only ever
have to store a single waker, but internally we dispatch any wakeups to
up to two actual wakers (one from the Sink impl and one from the Stream
impl).
5 years ago
Danny Browning
dc9c1b3d5f
Remove trace on start send
5 years ago
Danny Browning
8ed45bc110
More logging
5 years ago
Atul Bhosale
eb2c63ee73
Format code using 'cargo fmt'
5 years ago
Danny Browning
6cdf141a02
Build with no default features, examples still require default features
5 years ago
Sebastian Dröge
b76d8cbc03
Port/rename to async-std / async-tungstenite
5 years ago
Danny Browning
1cbac51d14
Bringing splitting back
5 years ago
Danny Browning
46ac847977
Use tokio built in dns
5 years ago
Danny Browning
3821e0952a
Tokio 0.2 Conversion
...
Update to use tokio 0.2 ecosystem to integrate with tungstenite.
5 years ago
Artem Vorotnikov
9bd5f01784
Upgrade to Rust 2018, format the code
5 years ago
Naja Melan
380f531d86
Fix some clippy warnings about unnecessary closures for more concise code
5 years ago
Naja Melan
0793764dcd
Add `dyn` to silence compiler warnings
5 years ago
Daniel Abramov
e2cdf11bc8
Update to the latest `tungstenite-rs` version
6 years ago
Jeffrey Esquivel S
eda57a012c
Implement support to get the peer address
6 years ago
Daniel Abramov
7d2f0c9ffb
Return `Close` messages to the user
...
Solves #45 and #51
6 years ago
Andreas Neuhaus
430c06048d
Add `MaybeTlsStream` wrapper type for streams that optionally use TLS
...
Connecting to a URL wraps the connection into this wrapper type based
on the protocol of the URL (`ws:` or `wss:`). Making this type public
allows client applications to specify the websocket's type without
importing the tokio_tls crate.
6 years ago
Ryan Leckey
b9b6f2de5a
Update tokio-tls to 0.2 and replace fully tokio-core with tokio
6 years ago
Daniel Abramov
b61ed96561
Update to the newest `tungstenite-rs` version
...
* Fixes #35
* Replaces https://github.com/snapview/tokio-tungstenite/pull/40
* Gives a good background for https://github.com/snapview/tokio-tungstenite/pull/41
7 years ago
Markus Kohlhase
475486a0a1
fix tokio import
7 years ago
Euan Rochester
e2012633b4
Port to tokio reform
7 years ago
Ran Benita
0db773ab36
Allow constructing WebSocketStream without performing a handshake
...
Add wrappers around similar constructors for tungstenite::WebSocket.
These are useful when doing protocol upgrades in a hyper server, where
the handshake was already performed by the HTTP server.
7 years ago
Alexey Galakhov
370a10fc10
trivial: make tungstenite crate public
...
Signed-off-by: Alexey Galakhov <agalakhov@snapview.de>
7 years ago
Alexey Galakhov
d79ffb5750
connect: add function for stream upgrading
...
Signed-off-by: Alexey Galakhov <agalakhov@snapview.de>
7 years ago
Alexey Galakhov
da74321bc8
connect: parametrize AutoStream with Stream
...
Signed-off-by: Alexey Galakhov <agalakhov@snapview.de>
7 years ago
Daniel Abramov
16c4693c91
Implement `Stream::close` for WebSocket
7 years ago
Alexey Galakhov
77d4d5b66f
Update for Tungstenite 0.5.0
...
Signed-off-by: Alexey Galakhov <agalakhov@snapview.de>
7 years ago
Daniel Abramov
c0ab50ba57
Remove deprecated futures features
7 years ago
Daniel Abramov
f9c3948c51
Replace redundant `Request` structure
...
Let's reuse the corresponding structure from tungstenite.
7 years ago
Daniel Abramov
b0ad00230b
Adapts tokio-tungstenite to tungstenite/headers
...
Basically changes the code of tokio-tungstenite to match the latest
(current) status of tungstenite-rs. Fixes #13 , fixes #9 , fixes #6 .
7 years ago
Alexey Galakhov
e7c3ef5250
Set TCP_NODELAY on connect.
...
Signed-off-by: Alexey Galakhov <agalakhov@snapview.de>
8 years ago
Alexey Galakhov
5fbcd8d413
Add "connect" convenience function.
...
Signed-off-by: Alexey Galakhov <agalakhov@snapview.de>
8 years ago
Alexey Galakhov
c6b76a5c87
Add missing documentation for Url struct
...
Signed-off-by: Alexey Galakhov <agalakhov@snapview.de>
8 years ago
Alex Shapiro
15167ab718
allow client to initiate connection with extra headers
...
Alter `client_async` to allow connections with a Request object that may contain extra headers, including a WebSocket protocol.
8 years ago
Daniel Abramov
b2b77893c2
Migrate to the tokio-io ( fixes #1 )
8 years ago
Alexey Galakhov
1a7d3f976e
Cleanup unused macro_use
...
Signed-off-by: Alexey Galakhov <agalakhov@snapview.de>
8 years ago
Alexey Galakhov
4b646308be
refactor: use asyncronous handshakes
8 years ago
Alexey Galakhov
0a21d17042
Change Sink according to new tungstenite semantics
8 years ago
Daniel Abramov
dbd9c7775b
Add unit tests for handshakes
8 years ago
Daniel Abramov
ddf30ee987
Adds additional things for the handshakes
8 years ago
Daniel Abramov
e279aafd54
Documentation added
8 years ago
Daniel Abramov
e1f65c4a20
Add tokio bindings for the library
...
Needs some improvements, for instance the copy-paste can be removed.
8 years ago
Daniel Abramov
a4315eb509
Repository created.
8 years ago