websocket 增加多分组 fork https://github.com/olahol/melody
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
410 B

10 years ago
  1. package melody
  2. // Package melody implements a framework for dealing with WebSockets.
  3. //
  4. // Example
  5. //
  6. // A broadcasting echo server:
  7. //
  8. // func main() {
  9. // r := gin.Default()
  10. // m := melody.New()
  11. // r.GET("/ws", func(c *gin.Context) {
  12. // m.HandleRequest(c.Writer, c.Request)
  13. // })
  14. // m.HandleMessage(func(s *melody.Session, msg []byte) {
  15. // m.Broadcast(msg)
  16. // })
  17. // r.Run(":5000")
  18. // }