eod commit

This commit is contained in:
2025-12-01 22:30:36 +01:00
parent 2372da942a
commit 8f7db6256b
9 changed files with 190 additions and 84 deletions

View File

@@ -1,11 +1,9 @@
package ws
import (
"context"
"encoding/json"
"homestead/homestead_gateway/util/cache"
"log/slog"
"sync"
"time"
"github.com/gorilla/websocket"
@@ -17,9 +15,10 @@ type WebsocketGateway struct {
bodySizeBytes int64
upgrader websocket.Upgrader
connsMu sync.Mutex
conns map[*websocket.Conn]connectionMetaData
cache cache.Cache
cache *cache.Cache
botConn *websocket.Conn
conns *cache.ConnectionCache
modHandler ModHandler
botHandler BotHandler
@@ -108,14 +107,9 @@ type BotHandshake struct {
}
type ModHandler interface {
Handle(ctx context.Context, msg GatewayModMessageIn) error
Handle(conn *websocket.Conn, msg GatewayModMessageIn) error
}
type BotHandler interface {
Handle(ctx context.Context, msg GatewayBotMessageIn) error
}
type connectionMetaData struct {
connectionType string // "mod" or "bot"
id string // server_id or bot_id for logging
Handle(conn *websocket.Conn, msg GatewayBotMessageIn) error
}