2024-03-31 05:04:48 +00:00
|
|
|
package services
|
|
|
|
|
|
|
|
import (
|
2024-04-13 05:48:19 +00:00
|
|
|
"git.solsynth.dev/hydrogen/passport/pkg/models"
|
2024-03-31 05:04:48 +00:00
|
|
|
"github.com/gofiber/contrib/websocket"
|
|
|
|
)
|
|
|
|
|
2024-03-31 08:03:59 +00:00
|
|
|
type WsPushRequest struct {
|
|
|
|
Payload []byte
|
|
|
|
RecipientID uint
|
|
|
|
}
|
|
|
|
|
2024-03-31 05:04:48 +00:00
|
|
|
var WsConn = make(map[uint][]*websocket.Conn)
|
|
|
|
|
|
|
|
func CheckOnline(user models.Account) bool {
|
|
|
|
return len(WsConn[user.ID]) > 0
|
|
|
|
}
|