mirror of https://github.com/JustKato/FreePad.git
* Hopefully a fix
This commit is contained in:
parent
5a8ccf20a8
commit
177ab62720
|
@ -4,7 +4,6 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/JustKato/FreePad/lib/objects"
|
"github.com/JustKato/FreePad/lib/objects"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
@ -34,13 +33,14 @@ func BindSocket(router *gin.RouterGroup) {
|
||||||
// Get the name of the pad to assign to this socket
|
// Get the name of the pad to assign to this socket
|
||||||
padName := ctx.Param("pad")
|
padName := ctx.Param("pad")
|
||||||
// Upgrade the socket connection
|
// Upgrade the socket connection
|
||||||
webSocketUpgrade(ctx.Writer, ctx.Request, padName)
|
webSocketUpgrade(ctx, padName)
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func webSocketUpgrade(w http.ResponseWriter, r *http.Request, padName string) {
|
func webSocketUpgrade(ctx *gin.Context, padName string) {
|
||||||
conn, err := wsUpgrader.Upgrade(w, r, nil)
|
|
||||||
|
conn, err := wsUpgrader.Upgrade(ctx.Writer, ctx.Request, ctx.Request.Header)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("Failed to set websocket upgrade: %v\n", err)
|
fmt.Printf("Failed to set websocket upgrade: %v\n", err)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue