Skip to content

gzatxm/websocket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

基于github.com/gobwas/ws库开发的server端框架

Example

go get github.com/gobwas/ws
go get github.com/gzatxm/websocket

serv := server.NewServer(9008, "/", 3600, false, "", "")

server.OnOpen = func(r *http.Request) (isOpen bool, code int) {
    isOpen = true
    code = 101
    return
}

serv.OnMessage = func(fd int64, data []byte) {
    fmt.Printf("%dCliend send:%s\n", fd, string(data))
    serv.Send(fd, data)
}

serv.OnClose = func(fd int64) {
    //deal close
}

serv.Run()

About

Base on gobwas/ws of websocket go.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages