Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
58 lines (38 sloc) 696 Bytes

+++ title = "WebSocket Recipe" description = "WebSocket recipe for Echo" [menu.main] name = "WebSocket" parent = "cookbook" +++

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

Hello, Client!
Hello, Client!
Hello, Client!
Hello, Client!
Hello, Client!

Server

Hello, Server!
Hello, Server!
Hello, Server!
Hello, Server!
Hello, Server!

[Source Code]({{< source "websocket" >}})

Maintainers