Skip to content

Commit

Permalink
Merge pull request #2429 from stakwork/feat/websocket_persit
Browse files Browse the repository at this point in the history
feat: move the websocket unique id creation to the frontned
  • Loading branch information
elraphty authored Jan 14, 2025
2 parents 33364ce + 010f507 commit 42d01f4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions websocket/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (

"github.com/gorilla/websocket"
"github.com/stakwork/sphinx-tribes/config"
"github.com/stakwork/sphinx-tribes/utils"
)

var WebsocketPool = NewPool()
Expand Down Expand Up @@ -35,8 +34,9 @@ func Upgrade(w http.ResponseWriter, r *http.Request) (*websocket.Conn, error) {
return conn, nil
}

func ServeWs(pool *Pool, w http.ResponseWriter, r *http.Request) {
websocketToken := utils.GetRandomToken(40)
func ServeWs(pool *Pool, w http.ResponseWriter, r *http.Request) { // get url query params
queryParams := r.URL.Query()
uniqueId := queryParams.Get("uniqueId")

conn, err := Upgrade(w, r)
if err != nil {
Expand All @@ -45,7 +45,7 @@ func ServeWs(pool *Pool, w http.ResponseWriter, r *http.Request) {
}

client := &Client{
Host: websocketToken,
Host: uniqueId,
Conn: conn,
Pool: pool,
}
Expand Down

0 comments on commit 42d01f4

Please sign in to comment.