2015-10-01 18:24:38 -07:00
|
|
|
---
|
|
|
|
title: WebSocket
|
|
|
|
menu:
|
2015-10-08 13:54:31 -07:00
|
|
|
side:
|
2015-10-01 18:24:38 -07:00
|
|
|
parent: recipes
|
2015-10-08 13:54:31 -07:00
|
|
|
weight: 5
|
2015-10-01 18:24:38 -07:00
|
|
|
---
|
2015-06-30 11:51:08 -07:00
|
|
|
|
2015-10-07 17:04:51 -07:00
|
|
|
### Server
|
2015-07-02 23:21:21 -07:00
|
|
|
|
2015-06-30 11:51:08 -07:00
|
|
|
`server.go`
|
|
|
|
|
2015-10-08 13:54:31 -07:00
|
|
|
{{< embed "websocket/server.go" >}}
|
2015-06-30 11:51:08 -07:00
|
|
|
|
2015-10-07 17:04:51 -07:00
|
|
|
### Client
|
2015-07-02 23:21:21 -07:00
|
|
|
|
2015-07-02 22:55:00 -07:00
|
|
|
`index.html`
|
|
|
|
|
2015-10-08 13:54:31 -07:00
|
|
|
{{< embed "websocket/public/index.html" >}}
|
2015-07-02 22:55:00 -07:00
|
|
|
|
2015-10-07 17:04:51 -07:00
|
|
|
### Output
|
2015-07-02 23:21:21 -07:00
|
|
|
|
|
|
|
`Client`
|
|
|
|
|
|
|
|
```sh
|
|
|
|
Hello, Client!
|
|
|
|
Hello, Client!
|
|
|
|
Hello, Client!
|
|
|
|
Hello, Client!
|
|
|
|
Hello, Client!
|
|
|
|
```
|
|
|
|
|
|
|
|
`Server`
|
|
|
|
|
|
|
|
```sh
|
|
|
|
Hello, Server!
|
|
|
|
Hello, Server!
|
|
|
|
Hello, Server!
|
|
|
|
Hello, Server!
|
|
|
|
Hello, Server!
|
|
|
|
```
|
|
|
|
|
2015-10-07 17:04:51 -07:00
|
|
|
### Maintainers
|
2015-10-07 15:41:15 -07:00
|
|
|
|
2015-10-08 13:54:31 -07:00
|
|
|
- [vishr](https://github.com/vishr)
|
2015-10-07 15:41:15 -07:00
|
|
|
|
2016-03-05 14:34:34 -08:00
|
|
|
### [Source Code](https://github.com/vishr/echo-recipes/blob/master/v1/websocket)
|