Skip to content

hsson/gows

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hsson/gows (Go Websocket)

PkgGoDev GoReportCard

Websocket servers in Go (Golang) made simple!

gows is a high-level abstraction of a Websocket server that hides away all the boring an complicated details of dealing with a websocket connection. Under the hood, the gorilla/websocket package is used. When using gows, Ping/Pong is automatically handled and you can read and write messages with ease.

Example

The following is an example of a websocket server that simply echoes whatever is being sent from the client:

func echo(w http.ResponseWriter, r *http.Request) {
	ws, err := gows.Upgrade(w, r)
	if err != nil {
		// error handling...
	}

	for {
		msg := <-ws.Read()
		ws.WriteText(msg.Data)
	}
}

About

Easy to use Websocket server abstraction for Go (Golang)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages