websocket.go 282 B

12345678910111213141516
  1. package global
  2. import (
  3. "github.com/gorilla/websocket"
  4. "net/http"
  5. )
  6. // Upgrader WebSocket 升级器
  7. var Upgrader = websocket.Upgrader{
  8. ReadBufferSize: 1024,
  9. WriteBufferSize: 1024,
  10. // 允许所有来源的连接
  11. CheckOrigin: func(r *http.Request) bool {
  12. return true
  13. },
  14. }