implement new json_data model
This commit is contained in:
32
server/models/connections.go
Normal file
32
server/models/connections.go
Normal 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)
|
||||
}
|
Reference in New Issue
Block a user