add CORS.

This commit is contained in:
Miroslav Šedivý
2021-01-23 18:18:14 +01:00
parent 79d67c4a09
commit d30d6deb79
6 changed files with 48 additions and 14 deletions

View File

@ -4,6 +4,8 @@ import "net/http"
type HandlerFunction func(Session, []byte) bool
type CheckOrigin func(r *http.Request) bool
type WebSocketPeer interface {
Send(v interface{}) error
Destroy() error
@ -13,5 +15,5 @@ type WebSocketManager interface {
Start()
Shutdown() error
AddHandler(handler HandlerFunction)
Upgrade(w http.ResponseWriter, r *http.Request) error
Upgrade(w http.ResponseWriter, r *http.Request, checkOrigin CheckOrigin) error
}