Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pdxjohnny/easysock
Go websockets building on gorilla/websockets
https://github.com/pdxjohnny/easysock
Last synced: about 1 month ago
JSON representation
Go websockets building on gorilla/websockets
- Host: GitHub
- URL: https://github.com/pdxjohnny/easysock
- Owner: pdxjohnny
- Created: 2015-08-01T15:57:03.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-08-27T22:55:01.000Z (about 9 years ago)
- Last Synced: 2024-03-16T06:51:34.364Z (8 months ago)
- Language: Go
- Size: 129 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
easysock
---This go package builds upon gorilla websocket's chat example
It provides a handler function for net/http `ServeWs` that along with calling
`easysock.Hub.Run` makes all websockets connected receive each others messagesExample Usage
---```go
package mainimport (
"flag"
"log"
"net/http""github.com/pdxjohnny/easysock"
)var addr = flag.String("addr", ":8080", "http service address")
func main() {
flag.Parse()
go easysock.Hub.Run()
http.HandleFunc("/ws", easysock.ServeWs)
err := http.ListenAndServe(*addr, nil)
if err != nil {
log.Fatal("ListenAndServe: ", err)
}
}
```