From e8a7b6e95261df24adfaa1b1ad672a8bb5738b52 Mon Sep 17 00:00:00 2001 From: Riley Thompson Date: Fri, 1 Mar 2024 12:52:32 -0500 Subject: [PATCH 1/2] use cookie for jwt --- be-jeopardy/internal/handlers/handlers.go | 43 ++++++++++++++++--- be-jeopardy/internal/jeopardy/game.go | 5 +-- be-jeopardy/internal/jeopardy/jeopardy.go | 4 +- be-jeopardy/main.go | 4 +- .../src/app/game/chat/chat.component.ts | 6 --- fe-jeopardy/src/app/game/game.component.ts | 6 --- fe-jeopardy/src/app/join/join.component.ts | 3 -- .../src/app/link-join/link-join.component.ts | 3 -- fe-jeopardy/src/app/services/api.service.ts | 18 ++------ fe-jeopardy/src/app/services/jwt.service.ts | 27 ------------ 10 files changed, 45 insertions(+), 74 deletions(-) delete mode 100644 fe-jeopardy/src/app/services/jwt.service.ts diff --git a/be-jeopardy/internal/handlers/handlers.go b/be-jeopardy/internal/handlers/handlers.go index ddef490..9c64275 100644 --- a/be-jeopardy/internal/handlers/handlers.go +++ b/be-jeopardy/internal/handlers/handlers.go @@ -101,6 +101,8 @@ var ( return r.Header.Get("Origin") == os.Getenv("ALLOW_ORIGIN") }, } + + jwtCookie = "jeopardy_access_token" ) const ( @@ -115,7 +117,12 @@ const ( func GetPlayerGame(c *gin.Context) { log.Infof("Received get player game request") - token := c.Request.Header.Get("Access-Token") + token, err := c.Cookie(jwtCookie) + if err != nil { + log.Errorf("Error getting token from cookie: %s", err.Error()) + respondWithError(c, http.StatusForbidden, ErrInvalidAuthCredMsg) + } + playerId, err := auth.GetJWTSubject(token) if err != nil { log.Errorf(ErrGettingPlayerIdMsg, err.Error()) @@ -165,9 +172,10 @@ func CreatePrivateGame(c *gin.Context) { return } + setJwtCookie(c, jwt) + c.JSON(http.StatusOK, jeopardy.Response{ Code: http.StatusOK, - Token: jwt, Message: "Authorized to create private game", Game: game, }) @@ -197,9 +205,10 @@ func JoinGameByCode(c *gin.Context) { return } + setJwtCookie(c, jwt) + c.JSON(http.StatusOK, jeopardy.Response{ Code: http.StatusOK, - Token: jwt, Message: "Authorized to join game by code", Game: game, }) @@ -233,9 +242,10 @@ func JoinPublicGame(c *gin.Context) { return } + setJwtCookie(c, jwt) + c.JSON(http.StatusOK, jeopardy.Response{ Code: http.StatusOK, - Token: jwt, Message: "Authorized to join public game", Game: game, }) @@ -284,7 +294,12 @@ func JoinGameChat(c *gin.Context) { func AddBot(c *gin.Context) { log.Infof("Received add bot request") - token := c.Request.Header.Get("Access-Token") + token, err := c.Cookie(jwtCookie) + if err != nil { + log.Errorf("Error getting token from cookie: %s", err.Error()) + respondWithError(c, http.StatusForbidden, ErrInvalidAuthCredMsg) + } + playerId, err := auth.GetJWTSubject(token) if err != nil { log.Errorf(ErrGettingPlayerIdMsg, err.Error()) @@ -343,7 +358,12 @@ func PlayGame(c *gin.Context) { func PlayAgain(c *gin.Context) { log.Infof("Received play again request") - token := c.Request.Header.Get("Access-Token") + token, err := c.Cookie(jwtCookie) + if err != nil { + log.Errorf("Error getting token from cookie: %s", err.Error()) + respondWithError(c, http.StatusForbidden, ErrInvalidAuthCredMsg) + } + playerId, err := auth.GetJWTSubject(token) if err != nil { log.Errorf(ErrGettingPlayerIdMsg, err.Error()) @@ -366,7 +386,12 @@ func PlayAgain(c *gin.Context) { func LeaveGame(c *gin.Context) { log.Infof("Received leave request") - token := c.Request.Header.Get("Access-Token") + token, err := c.Cookie(jwtCookie) + if err != nil { + log.Errorf("Error getting token from cookie: %s", err.Error()) + respondWithError(c, http.StatusForbidden, ErrInvalidAuthCredMsg) + } + playerId, err := auth.GetJWTSubject(token) if err != nil { log.Errorf(ErrGettingPlayerIdMsg, err.Error()) @@ -424,3 +449,7 @@ func closeConnWithMsg(conn *websocket.Conn, code int, msg string, args ...any) { func respondWithError(c *gin.Context, code int, msg string, args ...any) { c.JSON(code, jeopardy.Response{Code: code, Message: fmt.Sprintf(msg, args...)}) } + +func setJwtCookie(c *gin.Context, jwt string) { + c.SetCookie(jwtCookie, jwt, 24*3600, "/", "", false, true) +} diff --git a/be-jeopardy/internal/jeopardy/game.go b/be-jeopardy/internal/jeopardy/game.go index 3d2affd..18bbba0 100644 --- a/be-jeopardy/internal/jeopardy/game.go +++ b/be-jeopardy/internal/jeopardy/game.go @@ -85,7 +85,7 @@ type ( FinalAnswers []string `json:"finalAnswers"` Paused bool `json:"paused"` PausedState GameState `json:"pausedState"` - PausedAt time.Time `json:"pausedAt"` + pausedAt time.Time StartBuzzCountdown bool `json:"startBuzzCountdown"` StartFinalAnswerCountdown bool `json:"startFinalAnswerCountdown"` @@ -148,7 +148,6 @@ type ( Response struct { Code int `json:"code"` - Token string `json:"token,omitempty"` Message string `json:"message"` Game *Game `json:"game,omitempty"` CurPlayer GamePlayer `json:"curPlayer,omitempty"` @@ -246,7 +245,7 @@ func (g *Game) restartGame() { } func (g *Game) pauseGame(player GamePlayer) { - g.PausedAt = time.Now() + g.pausedAt = time.Now() g.Paused = true g.PausedState = g.State if g.State != PostGame { diff --git a/be-jeopardy/internal/jeopardy/jeopardy.go b/be-jeopardy/internal/jeopardy/jeopardy.go index 91b5c9c..3da9041 100644 --- a/be-jeopardy/internal/jeopardy/jeopardy.go +++ b/be-jeopardy/internal/jeopardy/jeopardy.go @@ -262,13 +262,13 @@ func PlayAgain(playerId string) error { func CleanUpGames() { log.Infof("Performing game cleanup") for _, game := range publicGames { - if game.Paused && time.Since(game.PausedAt) > time.Hour { + if game.Paused && time.Since(game.pausedAt) > time.Hour { log.Infof("Game %s has been paused for over an hour, removing it", game.Name) removeGame(game) } } for _, game := range privateGames { - if game.Paused && time.Since(game.PausedAt) > time.Hour { + if game.Paused && time.Since(game.pausedAt) > time.Hour { log.Infof("Game %s has been paused for over an hour, removing it", game.Name) removeGame(game) } diff --git a/be-jeopardy/main.go b/be-jeopardy/main.go index 3107cae..01b7056 100644 --- a/be-jeopardy/main.go +++ b/be-jeopardy/main.go @@ -26,8 +26,8 @@ func main() { log.Fatalf("Failed to set trusted proxies: %s", err) } corsConfig := cors.DefaultConfig() - corsConfig.AllowAllOrigins = true - corsConfig.AllowHeaders = append(corsConfig.AllowHeaders, "Access-Token") + corsConfig.AllowCredentials = true + corsConfig.AllowOrigins = []string{os.Getenv("ALLOW_ORIGIN")} router.Use(cors.New(corsConfig)) for _, route := range handlers.Routes { router.Handle(route.Method, route.Path, route.Handler) diff --git a/fe-jeopardy/src/app/game/chat/chat.component.ts b/fe-jeopardy/src/app/game/chat/chat.component.ts index 91b05e6..d848bef 100644 --- a/fe-jeopardy/src/app/game/chat/chat.component.ts +++ b/fe-jeopardy/src/app/game/chat/chat.component.ts @@ -1,7 +1,6 @@ import { Component, OnInit, AfterViewChecked } from '@angular/core' import { Message } from '../../model/model' import { PlayerService } from 'src/app/services/player.service' -import { JwtService } from 'src/app/services/jwt.service' import { ChatService } from 'src/app/services/chat.service' import { Ping } from '../../model/model' @@ -21,14 +20,9 @@ export class ChatComponent implements OnInit, AfterViewChecked { constructor( private chatService: ChatService, protected player: PlayerService, - protected jwtService: JwtService, ) { } ngOnInit(): void { - this.jwtService.jwt$.subscribe(jwt => { - this.jwt = jwt - }) - this.chatService.Connect() this.chatService.OnOpen(() => { diff --git a/fe-jeopardy/src/app/game/game.component.ts b/fe-jeopardy/src/app/game/game.component.ts index bfb5db1..2157a66 100644 --- a/fe-jeopardy/src/app/game/game.component.ts +++ b/fe-jeopardy/src/app/game/game.component.ts @@ -3,7 +3,6 @@ import { Router } from '@angular/router' import { GameStateService } from '../services/game-state.service' import { WebsocketService } from '../services/websocket.service' import { PlayerService } from '../services/player.service' -import { JwtService } from '../services/jwt.service' import { GameState, Ping } from '../model/model' import { ModalComponent } from '../modal/modal.component' @@ -37,16 +36,11 @@ export class GameComponent implements OnInit { constructor( private websocketService: WebsocketService, - private jwtService: JwtService, protected game: GameStateService, protected player: PlayerService, ) { } ngOnInit(): void { - this.jwtService.jwt$.subscribe(jwt => { - this.jwt = jwt - }) - let showJeopardyMusicInfo = localStorage.getItem('showJeopardyMusicInfo') if (showJeopardyMusicInfo === null) { this.showMusicInfo = true diff --git a/fe-jeopardy/src/app/join/join.component.ts b/fe-jeopardy/src/app/join/join.component.ts index 39b2326..51ad952 100644 --- a/fe-jeopardy/src/app/join/join.component.ts +++ b/fe-jeopardy/src/app/join/join.component.ts @@ -1,6 +1,5 @@ import { Component, ViewChild } from '@angular/core' import { Router } from '@angular/router' -import { JwtService } from '../services/jwt.service' import { ApiService } from '../services/api.service' import { Observer } from 'rxjs' import { ServerUnavailableMsg } from '../constants' @@ -20,14 +19,12 @@ export class JoinComponent { constructor( private router: Router, - private jwtService: JwtService, private apiService: ApiService, ) { } private joinResp(): Partial> { return { next: (resp: any) => { - this.jwtService.SetJWT(resp.token) this.router.navigate([`/game/${resp.game.name}`]) }, error: (err: any) => { diff --git a/fe-jeopardy/src/app/link-join/link-join.component.ts b/fe-jeopardy/src/app/link-join/link-join.component.ts index d3adf2d..33f09a5 100644 --- a/fe-jeopardy/src/app/link-join/link-join.component.ts +++ b/fe-jeopardy/src/app/link-join/link-join.component.ts @@ -1,7 +1,6 @@ import { Component, ViewChild } from '@angular/core'; import { Router, ActivatedRoute } from '@angular/router'; import { ApiService } from '../services/api.service'; -import { JwtService } from '../services/jwt.service'; import { ServerUnavailableMsg } from '../constants'; import { ModalComponent } from '../modal/modal.component'; @@ -20,7 +19,6 @@ export class LinkJoinComponent { private route: ActivatedRoute, private router: Router, private apiService: ApiService, - private jwtService: JwtService, ) { this.gameCode = this.route.snapshot.paramMap.get('gameCode') ?? ''; } @@ -28,7 +26,6 @@ export class LinkJoinComponent { joinGame(playerName: string, gameCode: string) { this.apiService.JoinGameByCode(playerName, gameCode).subscribe({ next: (resp: any) => { - this.jwtService.SetJWT(resp.token); this.router.navigate([`/game/${resp.game.name}`]); }, error: (err: any) => { diff --git a/fe-jeopardy/src/app/services/api.service.ts b/fe-jeopardy/src/app/services/api.service.ts index 4c562dc..0ca54c7 100644 --- a/fe-jeopardy/src/app/services/api.service.ts +++ b/fe-jeopardy/src/app/services/api.service.ts @@ -2,27 +2,16 @@ import { Injectable } from '@angular/core'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { environment } from '../../environments/environment'; import { Observable } from 'rxjs'; -import { JwtService } from './jwt.service'; const apiAddr = environment.apiServerUrl; const httpProtocol = environment.httpProtocol; -const JsonOpts = { - headers: new HttpHeaders({ - 'Content-Type': 'application/json', - 'Accept': 'application/json' - }) -} - @Injectable({ providedIn: 'root' }) export class ApiService { - constructor( - private http: HttpClient, - private jwtService: JwtService, - ) { } + constructor(private http: HttpClient) { } CreatePrivateGame(playName: string, bots: number): Observable { return this.post('games', { @@ -87,9 +76,8 @@ export class ApiService { return { headers: new HttpHeaders({ 'Content-Type': 'application/json', - 'Accept': 'application/json', - 'Access-Token': this.jwtService.GetJWT(), - }) + }), + withCredentials: true, } } diff --git a/fe-jeopardy/src/app/services/jwt.service.ts b/fe-jeopardy/src/app/services/jwt.service.ts deleted file mode 100644 index b161739..0000000 --- a/fe-jeopardy/src/app/services/jwt.service.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Injectable } from '@angular/core'; -import { BehaviorSubject, Observable } from 'rxjs'; - -const jeopardyJWT = 'jeopardyJWT'; - -@Injectable({ - providedIn: 'root' -}) -export class JwtService { - private jwtSubject: BehaviorSubject; - public jwt$: Observable; - - constructor() { - const storedJwt: string = localStorage.getItem(jeopardyJWT) ?? ''; - this.jwtSubject = new BehaviorSubject(storedJwt); - this.jwt$ = this.jwtSubject.asObservable(); - } - - SetJWT(jwt: string): void { - localStorage.setItem(jeopardyJWT, jwt); - this.jwtSubject.next(jwt); - } - - GetJWT(): string { - return localStorage.getItem(jeopardyJWT) ?? ''; - } -} From ca718b902e82e04727196b30beee1b0e849992fa Mon Sep 17 00:00:00 2001 From: Riley Thompson Date: Fri, 1 Mar 2024 13:46:26 -0500 Subject: [PATCH 2/2] refactor websocket tokens --- be-jeopardy/internal/handlers/handlers.go | 71 ++++++------------- be-jeopardy/internal/jeopardy/chat.go | 19 +++-- be-jeopardy/internal/jeopardy/jeopardy.go | 24 +++++-- .../src/app/game/chat/chat.component.ts | 4 -- fe-jeopardy/src/app/game/game.component.ts | 7 -- 5 files changed, 51 insertions(+), 74 deletions(-) diff --git a/be-jeopardy/internal/handlers/handlers.go b/be-jeopardy/internal/handlers/handlers.go index 9c64275..019276e 100644 --- a/be-jeopardy/internal/handlers/handlers.go +++ b/be-jeopardy/internal/handlers/handlers.go @@ -254,41 +254,28 @@ func JoinPublicGame(c *gin.Context) { func JoinGameChat(c *gin.Context) { log.Infof("Received request to join game chat") - ws, err := upgrader.Upgrade(c.Writer, c.Request, nil) - if err != nil { - log.Errorf("Error upgrading connection to WebSocket: %s", err.Error()) - respondWithError(c, http.StatusInternalServerError, ErrJoiningChatMsg) - return - } - - _, msg, err := ws.ReadMessage() + token, err := c.Cookie(jwtCookie) if err != nil { - log.Errorf("Error reading message from WebSocket: %s", err.Error()) - closeConnWithMsg(ws, socket.ServerError, ErrJoiningChatMsg) - return - } - - var req TokenRequest - if err := json.Unmarshal(msg, &req); err != nil { - log.Errorf("Error parsing chat request: %s", err.Error()) - closeConnWithMsg(ws, socket.BadRequest, ErrMalformedReqMsg) + log.Errorf("Error getting token from cookie: %s", err.Error()) + respondWithError(c, http.StatusForbidden, ErrInvalidAuthCredMsg) return } - playerId, err := auth.GetJWTSubject(req.Token) + playerId, err := auth.GetJWTSubject(token) if err != nil { log.Errorf(ErrGettingPlayerIdMsg, err.Error()) - closeConnWithMsg(ws, socket.Unauthorized, ErrInvalidAuthCredMsg) + respondWithError(c, http.StatusUnauthorized, ErrInvalidAuthCredMsg) return } - conn := socket.NewSafeConn(ws) - err = jeopardy.JoinGameChat(playerId, conn) + ws, err := upgrader.Upgrade(c.Writer, c.Request, nil) if err != nil { - log.Errorf("Error joining chat: %s", err.Error()) - closeConnWithMsg(ws, socket.BadRequest, "Unable to join chat: %s", err.Error()) + log.Errorf("Error upgrading connection to WebSocket: %s", err.Error()) + respondWithError(c, http.StatusInternalServerError, ErrJoiningChatMsg) return } + + jeopardy.JoinGameChat(playerId, ws) } func AddBot(c *gin.Context) { @@ -318,41 +305,28 @@ func AddBot(c *gin.Context) { func PlayGame(c *gin.Context) { log.Infof("Received play request") - ws, err := upgrader.Upgrade(c.Writer, c.Request, nil) - if err != nil { - log.Errorf("Error upgrading connection to WebSocket: %s", err.Error()) - respondWithError(c, http.StatusInternalServerError, UnexpectedServerErrMsg) - return - } - - _, msg, err := ws.ReadMessage() + token, err := c.Cookie(jwtCookie) if err != nil { - log.Errorf("Error reading message from WebSocket: %s", err.Error()) - closeConnWithMsg(ws, socket.ServerError, UnexpectedServerErrMsg) - return - } - - var req TokenRequest - if err := json.Unmarshal(msg, &req); err != nil { - log.Errorf("Error parsing play request: %s", err.Error()) - closeConnWithMsg(ws, socket.BadRequest, ErrMalformedReqMsg) + log.Errorf("Error getting token from cookie: %s", err.Error()) + respondWithError(c, http.StatusForbidden, ErrInvalidAuthCredMsg) return } - playerId, err := auth.GetJWTSubject(req.Token) + playerId, err := auth.GetJWTSubject(token) if err != nil { log.Errorf(ErrGettingPlayerIdMsg, err.Error()) - closeConnWithMsg(ws, socket.Unauthorized, ErrInvalidAuthCredMsg) + respondWithError(c, http.StatusUnauthorized, ErrInvalidAuthCredMsg) return } - conn := socket.NewSafeConn(ws) - err = jeopardy.PlayGame(playerId, conn) + ws, err := upgrader.Upgrade(c.Writer, c.Request, nil) if err != nil { - log.Errorf("Error playing game: %s", err.Error()) - closeConnWithMsg(ws, socket.BadRequest, "Unable to play game: %s", err.Error()) + log.Errorf("Error upgrading connection to WebSocket: %s", err.Error()) + respondWithError(c, http.StatusInternalServerError, UnexpectedServerErrMsg) return } + + jeopardy.PlayGame(playerId, ws) } func PlayAgain(c *gin.Context) { @@ -441,11 +415,6 @@ func parseBody(body io.ReadCloser, v any) error { return json.Unmarshal(msg, v) } -func closeConnWithMsg(conn *websocket.Conn, code int, msg string, args ...any) { - _ = conn.WriteJSON(jeopardy.Response{Code: code, Message: fmt.Sprintf(msg, args...)}) - _ = conn.Close() -} - func respondWithError(c *gin.Context, code int, msg string, args ...any) { c.JSON(code, jeopardy.Response{Code: code, Message: fmt.Sprintf(msg, args...)}) } diff --git a/be-jeopardy/internal/jeopardy/chat.go b/be-jeopardy/internal/jeopardy/chat.go index 9c9a505..90366af 100644 --- a/be-jeopardy/internal/jeopardy/chat.go +++ b/be-jeopardy/internal/jeopardy/chat.go @@ -7,6 +7,7 @@ import ( "github.com/gorilla/websocket" "github.com/rileythomp/jeopardy/be-jeopardy/internal/log" + "github.com/rileythomp/jeopardy/be-jeopardy/internal/socket" ) type ChatMessage struct { @@ -15,25 +16,31 @@ type ChatMessage struct { TimeStamp int64 `json:"timeStamp"` } -func JoinGameChat(playerId string, conn SafeConn) error { +func JoinGameChat(playerId string, ws *websocket.Conn) { + conn := socket.NewSafeConn(ws) + game, err := GetPlayerGame(playerId) if err != nil { - return err + log.Errorf("Error getting game for player %s: %s", playerId, err.Error()) + closeConnWithMsg(conn, socket.BadRequest, "Unable to join chat: %s", err.Error()) + return } player, err := game.getPlayerById(playerId) if err != nil { - return err + log.Errorf("Error getting player by id: %s", err.Error()) + closeConnWithMsg(conn, socket.BadRequest, "Unable to join chat: %s", err.Error()) + return } if player.chatConn() != nil { - return fmt.Errorf("Player already in chat") + log.Errorf("Error joining chat: Player already in chat") + closeConnWithMsg(conn, socket.BadRequest, "Unable to join chat: Player already in chat") + return } player.setChatConn(conn) player.sendChatPings() player.processChatMessages(game.chatChan) - - return nil } func (p *Player) processChatMessages(chatChan chan ChatMessage) { diff --git a/be-jeopardy/internal/jeopardy/jeopardy.go b/be-jeopardy/internal/jeopardy/jeopardy.go index 3da9041..c565a0b 100644 --- a/be-jeopardy/internal/jeopardy/jeopardy.go +++ b/be-jeopardy/internal/jeopardy/jeopardy.go @@ -5,6 +5,7 @@ import ( "time" "github.com/google/uuid" + "github.com/gorilla/websocket" "github.com/rileythomp/jeopardy/be-jeopardy/internal/db" "github.com/rileythomp/jeopardy/be-jeopardy/internal/log" "github.com/rileythomp/jeopardy/be-jeopardy/internal/socket" @@ -167,26 +168,32 @@ func AddBot(playerId string) error { return nil } -func PlayGame(playerId string, conn SafeConn) error { +func PlayGame(playerId string, ws *websocket.Conn) { + conn := socket.NewSafeConn(ws) + game, err := GetPlayerGame(playerId) if err != nil { - return err + log.Errorf("Error getting game for player: %s", err.Error()) + closeConnWithMsg(conn, socket.BadRequest, "Unable to play game: %s", err.Error()) + return } player, err := game.getPlayerById(playerId) if err != nil { - return err + log.Errorf("Error getting player by id: %s", err.Error()) + closeConnWithMsg(conn, socket.BadRequest, "Unable to play game: %s", err.Error()) + return } if player.conn() != nil { - return fmt.Errorf("Player already playing") + log.Errorf("Error playing game: Player already playing") + closeConnWithMsg(conn, socket.BadRequest, "Unable to play game: Player already playing") + return } player.setConn(conn) player.sendPings() player.readMessages(game.msgChan, game.pauseChan) game.handlePlayerJoined(player) - - return nil } func (g *Game) handlePlayerJoined(player GamePlayer) { @@ -285,3 +292,8 @@ func removeGame(g *Game) { delete(playerGames, p.id()) } } + +func closeConnWithMsg(conn SafeConn, code int, msg string, args ...any) { + _ = conn.WriteJSON(Response{Code: code, Message: fmt.Sprintf(msg, args...)}) + _ = conn.Close() +} diff --git a/fe-jeopardy/src/app/game/chat/chat.component.ts b/fe-jeopardy/src/app/game/chat/chat.component.ts index d848bef..2df5659 100644 --- a/fe-jeopardy/src/app/game/chat/chat.component.ts +++ b/fe-jeopardy/src/app/game/chat/chat.component.ts @@ -25,10 +25,6 @@ export class ChatComponent implements OnInit, AfterViewChecked { ngOnInit(): void { this.chatService.Connect() - this.chatService.OnOpen(() => { - this.chatService.Send({ token: this.jwt }) - }) - this.chatService.OnMessage((event: { data: string }) => { let resp = JSON.parse(event.data) diff --git a/fe-jeopardy/src/app/game/game.component.ts b/fe-jeopardy/src/app/game/game.component.ts index 2157a66..06a81f2 100644 --- a/fe-jeopardy/src/app/game/game.component.ts +++ b/fe-jeopardy/src/app/game/game.component.ts @@ -52,13 +52,6 @@ export class GameComponent implements OnInit { this.websocketService.Connect('play') - this.websocketService.OnOpen(() => { - this.websocketService.Send({ - state: GameState.PreGame, - token: this.jwt, - }) - }) - this.websocketService.OnMessage((event: { data: string }) => { let resp = JSON.parse(event.data)