1
0
mirror of https://github.com/labstack/echo.git synced 2025-01-01 22:09:21 +02:00
echo/website/content/recipes/websocket.md

59 lines
710 B
Markdown
Raw Normal View History

+++
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)