mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-28 09:42:40 +01:00
Guide: updates to the WebSockets chapter.
This commit is contained in:
parent
ab60ec6e1d
commit
1f08100f6f
@ -3,10 +3,10 @@
|
|||||||
Actix supports WebSockets out-of-the-box. It is possible to convert a request's `Payload`
|
Actix supports WebSockets out-of-the-box. It is possible to convert a request's `Payload`
|
||||||
to a stream of [*ws::Message*](../actix_web/ws/enum.Message.html) with
|
to a stream of [*ws::Message*](../actix_web/ws/enum.Message.html) with
|
||||||
a [*ws::WsStream*](../actix_web/ws/struct.WsStream.html) and then use stream
|
a [*ws::WsStream*](../actix_web/ws/struct.WsStream.html) and then use stream
|
||||||
combinators to handle actual messages. But it is simpler to handle websocket communications
|
combinators to handle actual messages, but it is simpler to handle websocket communications
|
||||||
with an http actor.
|
with an http actor.
|
||||||
|
|
||||||
This is example of a simple websocket echo server:
|
The following is example of a simple websocket echo server:
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
# extern crate actix;
|
# extern crate actix;
|
||||||
@ -41,8 +41,8 @@ fn main() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
A simple websocket echo server example is available in the
|
> A simple websocket echo server example is available in the
|
||||||
[examples directory](https://github.com/actix/actix-web/blob/master/examples/websocket).
|
> [examples directory](https://github.com/actix/actix-web/blob/master/examples/websocket).
|
||||||
|
|
||||||
An example chat server with the ability to chat over a websocket or tcp connection
|
> An example chat server with the ability to chat over a websocket or tcp connection
|
||||||
is available in [websocket-chat directory](https://github.com/actix/actix-web/tree/master/examples/websocket-chat/)
|
> is available in [websocket-chat directory](https://github.com/actix/actix-web/tree/master/examples/websocket-chat/)
|
||||||
|
Loading…
Reference in New Issue
Block a user