mirror of
https://github.com/labstack/echo.git
synced 2025-01-01 22:09:21 +02:00
054a310e70
Signed-off-by: Vishal Rana <vr@labstack.com>
59 lines
710 B
Markdown
59 lines
710 B
Markdown
+++
|
|
title = "WebSocket Example"
|
|
description = "WebSocket example for Echo"
|
|
[menu.main]
|
|
name = "WebSocket"
|
|
parent = "recipes"
|
|
weight = 5
|
|
+++
|
|
|
|
## Using `net` WebSocket
|
|
|
|
### Server
|
|
|
|
`server.go`
|
|
|
|
{{< embed "websocket/net/server.go" >}}
|
|
|
|
## Using `gorilla` WebSocket
|
|
|
|
### Server
|
|
|
|
`server.go`
|
|
|
|
{{< embed "websocket/gorilla/server.go" >}}
|
|
|
|
## Client
|
|
|
|
`index.html`
|
|
|
|
{{< embed "websocket/public/index.html" >}}
|
|
|
|
## Output
|
|
|
|
`Client`
|
|
|
|
```sh
|
|
Hello, Client!
|
|
Hello, Client!
|
|
Hello, Client!
|
|
Hello, Client!
|
|
Hello, Client!
|
|
```
|
|
|
|
`Server`
|
|
|
|
```sh
|
|
Hello, Server!
|
|
Hello, Server!
|
|
Hello, Server!
|
|
Hello, Server!
|
|
Hello, Server!
|
|
```
|
|
|
|
## [Source Code]({{< source "websocket" >}})
|
|
|
|
## Maintainers
|
|
|
|
- [vishr](https://github.com/vishr)
|