Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/johnandersen777/easysock
Go websockets building on gorilla/websockets
https://github.com/johnandersen777/easysock
Last synced: about 14 hours ago
JSON representation
Go websockets building on gorilla/websockets
- Host: GitHub
- URL: https://github.com/johnandersen777/easysock
- Owner: johnandersen777
- 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-10-24T09:12:20.255Z (25 days ago)
- Language: Go
- Size: 129 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- 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)
}
}
```