design and impl BaseServiceRequest

This commit is contained in:
Sam Lewis
2022-10-12 01:14:32 -04:00
parent 4cf16d0d41
commit 7f9e346d34
6 changed files with 54 additions and 11 deletions

View File

@@ -23,7 +23,7 @@ type AuthMessage struct {
func WriteMessage[T any](msg T, conn *websocket.Conn, ctx context.Context) error {
msgJson, err := json.Marshal(msg)
// fmt.Println(string(msgJson))
fmt.Println(string(msgJson))
if err != nil {
return err
}
@@ -100,6 +100,7 @@ func VerifyAuthResponse(conn *websocket.Conn, ctx context.Context) error {
var authResp authResponse
json.Unmarshal(msg, &authResp)
log.Println(authResp.MsgType)
if authResp.MsgType != "auth_ok" {
return errors.New("invalid auth token")
}