More socket
This commit is contained in:
parent
6c02bfd014
commit
85383e4865
|
@ -44,15 +44,15 @@ func WebsocketConnection(c *websocket.Conn) {
|
|||
}
|
||||
|
||||
func GetConnectedSockets(c *fiber.Ctx) error {
|
||||
jabber := map[string]socket.Socket[socket.JabberData]{}
|
||||
jabber := aid.JSON{}
|
||||
socket.JabberSockets.Range(func(key string, value *socket.Socket[socket.JabberData]) bool {
|
||||
jabber[key] = *value
|
||||
jabber[key] = value
|
||||
return true
|
||||
})
|
||||
|
||||
matchmaking := []socket.Socket[socket.MatchmakerData]{}
|
||||
matchmaking := aid.JSON{}
|
||||
socket.MatchmakerSockets.Range(func(key string, value *socket.Socket[socket.MatchmakerData]) bool {
|
||||
matchmaking = append(matchmaking, *value)
|
||||
matchmaking[key] = value
|
||||
return true
|
||||
})
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ Performance first, universal Fortnite private server backend written in Go.
|
|||
|
||||
- Gifting, Matchmaker and Battle Pass support.
|
||||
- Interact with external Services like Amazon S3 Buckets to save player data externally.
|
||||
- A way to interact with accounts outside of the game. This is mainly for a web app and other services to interact with the backend.
|
||||
- Refactor the XMPP solution to use [melium/xmpp](https://github.com/mellium/xmpp)
|
||||
|
||||
## Version Support
|
||||
|
||||
|
|
|
@ -19,12 +19,12 @@ type Socket[T JabberData | MatchmakerData] struct {
|
|||
Connection *websocket.Conn
|
||||
Data *T
|
||||
Person *person.Person
|
||||
mutex sync.Mutex
|
||||
M sync.Mutex
|
||||
}
|
||||
|
||||
func (s *Socket[T]) Write(payload []byte) {
|
||||
s.mutex.Lock()
|
||||
defer s.mutex.Unlock()
|
||||
s.M.Lock()
|
||||
defer s.M.Unlock()
|
||||
|
||||
s.Connection.WriteMessage(websocket.TextMessage, payload)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user