Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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
  • Socket score

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc