1
0
mirror of https://github.com/labstack/echo.git synced 2024-12-24 20:14:31 +02:00
echo/website/docs/recipes/websocket.md

28 lines
393 B
Markdown
Raw Normal View History

## WebSocket
`server.go`
```go
package main
import (
"io"
"github.com/labstack/echo"
mw "github.com/labstack/echo/middleware"
)
func main() {
e := echo.New()
e.Use(mw.Logger())
e.WebSocket("/ws", func(c *echo.Context) error {
io.Copy(c.Socket(), c.Socket())
return nil
})
e.Run(":1323")
}
```
## [Source Code](https://github.com/labstack/echo/blob/master/recipes/websocket)