first commit of files

This commit is contained in:
Adrian Zürcher
2025-04-18 10:30:18 +02:00
parent 5595af0add
commit f213f53547
22 changed files with 842 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
package models
import "github.com/coder/websocket"
type Subscribers map[*websocket.Conn]*bool
func InitSubsrcibers() Subscribers {
return make(Subscribers)
}
func (s *Subscribers) Connect(conn *websocket.Conn) {
b := true
(*s)[conn] = &b
}
func (s *Subscribers) DeleteSubsrcibers(conn *websocket.Conn) {
delete(*s, conn)
}
func (s *Subscribers) GetPointer(conn *websocket.Conn) *bool {
return (*s)[conn]
}
func (s *Subscribers) Disconnect(conn *websocket.Conn) {
*(*s)[conn] = false
}