mirror of
https://github.com/m1k1o/neko.git
synced 2025-08-03 08:50:13 +02:00
websocket upgrade as router handler.
This commit is contained in:
parent
fd9d5ec6f8
commit
f96466b7b9
3 changed files with 26 additions and 22 deletions
|
@ -37,11 +37,9 @@ func New(WebSocketManager types.WebSocketManager, ApiManager types.ApiManager, c
|
|||
|
||||
router.Route("/api", ApiManager.Route)
|
||||
|
||||
router.Get("/api/ws", func(w http.ResponseWriter, r *http.Request) error {
|
||||
return WebSocketManager.Upgrade(w, r, func(r *http.Request) bool {
|
||||
return config.AllowOrigin(r.Header.Get("Origin"))
|
||||
})
|
||||
})
|
||||
router.Get("/api/ws", WebSocketManager.Upgrade(func(r *http.Request) bool {
|
||||
return config.AllowOrigin(r.Header.Get("Origin"))
|
||||
}))
|
||||
|
||||
if config.Static != "" {
|
||||
fs := http.FileServer(http.Dir(config.Static))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue