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.

22 lines
569 B

10 years ago
10 years ago
10 years ago
  1. // Copyright 2015 Ola Holmström. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Package melody implements a framework for dealing with WebSockets.
  5. //
  6. // Example
  7. //
  8. // A broadcasting echo server:
  9. //
  10. // func main() {
  11. // r := gin.Default()
  12. // m := melody.New()
  13. // r.GET("/ws", func(c *gin.Context) {
  14. // m.HandleRequest(c.Writer, c.Request)
  15. // })
  16. // m.HandleMessage(func(s *melody.Session, msg []byte) {
  17. // m.Broadcast(msg)
  18. // })
  19. // r.Run(":5000")
  20. // }
  21. package melody