implement new json_data model

This commit is contained in:
Adrian Zürcher
2025-04-29 08:31:06 +02:00
parent 0a137c9d86
commit 49d8d03d8a
25 changed files with 609 additions and 572 deletions

View File

@@ -0,0 +1,32 @@
package models
import (
"sync"
"github.com/coder/websocket"
"github.com/gin-gonic/gin"
)
type Connections struct {
sync.RWMutex
Clients Clients
}
func NewConnections() *Connections {
return &Connections{
Clients: NewClients(),
}
}
// Connect a recieving websocket connection
func (c *Connections) ConnectRecievingWsConnection(id string, ctx *gin.Context) error {
return c.Clients.ConnectRecievingWsConnection(id, ctx)
}
func (c *Connections) RemoveClient(id string) {
c.Clients.RemoveClient(id)
}
func (c *Connections) DisconnectWsConnection(id string, code websocket.StatusCode, reason string) {
c.Clients.DisconnectWsConnection(id, code, reason)
}