eod commit
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user