2015-10-02 03:24:38 +02:00
|
|
|
---
|
|
|
|
title: WebSocket
|
|
|
|
menu:
|
2015-10-08 22:54:31 +02:00
|
|
|
side:
|
2015-10-02 03:24:38 +02:00
|
|
|
parent: recipes
|
2015-10-08 22:54:31 +02:00
|
|
|
weight: 5
|
2015-10-02 03:24:38 +02:00
|
|
|
---
|
2015-06-30 20:51:08 +02:00
|
|
|
|
2015-10-08 02:04:51 +02:00
|
|
|
### Server
|
2015-07-03 08:21:21 +02:00
|
|
|
|
2015-06-30 20:51:08 +02:00
|
|
|
`server.go`
|
|
|
|
|
2015-10-08 22:54:31 +02:00
|
|
|
{{< embed "websocket/server.go" >}}
|
2015-06-30 20:51:08 +02:00
|
|
|
|
2015-10-08 02:04:51 +02:00
|
|
|
### Client
|
2015-07-03 08:21:21 +02:00
|
|
|
|
2015-07-03 07:55:00 +02:00
|
|
|
`index.html`
|
|
|
|
|
2015-10-08 22:54:31 +02:00
|
|
|
{{< embed "websocket/public/index.html" >}}
|
2015-07-03 07:55:00 +02:00
|
|
|
|
2015-10-08 02:04:51 +02:00
|
|
|
### Output
|
2015-07-03 08:21:21 +02: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-08 02:04:51 +02:00
|
|
|
### Maintainers
|
2015-10-08 00:41:15 +02:00
|
|
|
|
2015-10-08 22:54:31 +02:00
|
|
|
- [vishr](https://github.com/vishr)
|
2015-10-08 00:41:15 +02:00
|
|
|
|
2015-10-08 02:04:51 +02:00
|
|
|
### [Source Code](https://github.com/labstack/echo/blob/master/recipes/websocket)
|