You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

github.com/gzatxm/websocket

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/gzatxm/websocket

v0.0.0-20180827102807-37cf4bb279c6
Source
Go
Version published
Created
Source

基于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()

FAQs

Package last updated on 27 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts