Documentation ¶
Index ¶
- Constants
- func TimeInformer(client safemqtt.Client)
- type ConnectedUsers
- func (cu *ConnectedUsers) Add(u *User)
- func (cu *ConnectedUsers) Broadcast(message *websocket.PreparedMessage)
- func (cu *ConnectedUsers) BroadcastDisconnectedUsers()
- func (cu *ConnectedUsers) BroadcastPositions()
- func (cu *ConnectedUsers) BroadcastUsersUpdate()
- func (cu *ConnectedUsers) Delete(id uuid.UUID)
- func (cu *ConnectedUsers) Get(id uuid.UUID) (*User, bool)
- func (cu *ConnectedUsers) GetOnSpace(spaceId uuid.UUID) []*User
- func (cu *ConnectedUsers) Num() int
- func (cu *ConnectedUsers) PerformBroadcast(message *websocket.PreparedMessage)
- func (cu *ConnectedUsers) Run()
- func (cu *ConnectedUsers) UserLeft(userId uuid.UUID)
- type ControllerHub
- func (ch *ControllerHub) AddWorldController(worldID uuid.UUID) (*WorldController, error)
- func (ch *ControllerHub) CancelCleanupSpace(id uuid.UUID)
- func (ch *ControllerHub) CancelCleanupUser(id uuid.UUID)
- func (ch *ControllerHub) ChangeHandler(client mqtt.Client, message mqtt.Message) error
- func (ch *ControllerHub) CleanupOnlineUsers() error
- func (ch *ControllerHub) CleanupSpace(id uuid.UUID) error
- func (ch *ControllerHub) CleanupSpaceWithDelay(id uuid.UUID, fn utils.TimerFunc[uuid.UUID])
- func (ch *ControllerHub) CleanupSpacesWithDelay() error
- func (ch *ControllerHub) CleanupUser(id uuid.UUID) error
- func (ch *ControllerHub) CleanupUserWithDelay(id uuid.UUID, fn utils.TimerFunc[uuid.UUID])
- func (ch *ControllerHub) CleanupUsersWithDelay() error
- func (ch *ControllerHub) GetNodeSettings() error
- func (ch *ControllerHub) GetUserSpawnPoint(uid uuid.UUID, URL *url.URL) (uuid.UUID, cmath.Vec3, error)
- func (ch *ControllerHub) GetWorldController(worldID uuid.UUID) (*WorldController, error)
- func (ch *ControllerHub) HashUserID(userId uuid.UUID) string
- func (ch *ControllerHub) NetworkRunner()
- func (ch *ControllerHub) UpdateTotalUsers()
- func (ch *ControllerHub) WriteInfluxPoint(point *influx_write.Point) error
- type EmojiMessage
- type LoadedSpaces
- func (ls *LoadedSpaces) Add(obj *Space)
- func (ls *LoadedSpaces) Delete(spaceId uuid.UUID)
- func (ls *LoadedSpaces) FindClosest(pos *cmath.Vec3) (uuid.UUID, cmath.Vec3)
- func (ls *LoadedSpaces) Get(spaceId uuid.UUID) (*Space, bool)
- func (ls *LoadedSpaces) GetPos(id uuid.UUID) (cmath.Vec3, error)
- func (ls *LoadedSpaces) GetPresent(spaceId uuid.UUID) (*Space, bool)
- func (ls *LoadedSpaces) Init()
- func (ls *LoadedSpaces) Load(req *RegRequest) *Space
- func (ls *LoadedSpaces) LoadFromEntry(req *RegRequest, entry map[string]interface{}) *Space
- func (ls *LoadedSpaces) Num() int
- func (ls *LoadedSpaces) Unload(spaceId uuid.UUID) error
- type RegRequest
- type Space
- func (s *Space) AddSpaceTags(prefix string, p *write.Point) *write.Point
- func (s *Space) CalculateVibes() (int64, error)
- func (s *Space) DeInit()
- func (s *Space) GetObjectDef() *websocket.PreparedMessage
- func (s *Space) GetOnlineUsers() (int64, error)
- func (s *Space) Init() error
- func (s *Space) MQTTEffectsHandler(msg []byte)
- func (s *Space) MQTTMessageHandler(_ mqtt.Client, msg mqtt.Message)
- func (s *Space) RecursiveSendAllAttributes(connection *socket.Connection)
- func (s *Space) RecursiveSendAllStrings(connection *socket.Connection)
- func (s *Space) RecursiveSendAllTextures(connection *socket.Connection)
- func (s *Space) SendToUsersOnSpace(msg *websocket.PreparedMessage)
- func (s *Space) SetPosition(pos cmath.Vec3)
- func (s *Space) UpdateChildren() error
- func (s *Space) UpdateMeta() error
- func (s *Space) UpdateMetaFromMap(entry map[string]interface{}) error
- func (s *Space) UpdateObjectDef()
- func (s *Space) UpdatePosition(pos cmath.Vec3, theta float64, force bool) error
- func (s *Space) UpdateSpace() error
- type User
- func (u *User) AddUserTags(prefix string, p *write.Point) *write.Point
- func (u *User) CheckIfMegaMoji(emojiMessage *EmojiMessage, spaceID uuid.UUID, msg []byte) error
- func (u *User) HandleEmoji(m *posbus.RelayToController) error
- func (u *User) HandleHighFive(m *posbus.TriggerInteraction) error
- func (u *User) HandleSignals(s posbus.Signal)
- func (u *User) HandleStake(m *posbus.TriggerInteraction)
- func (u *User) InteractionHandler(m *posbus.TriggerInteraction)
- func (u *User) MQTTMessageHandler(_ mqtt.Client, msg mqtt.Message)
- func (u *User) OfflineAction() error
- func (u *User) OnMessage(msg *posbus.Message)
- func (u *User) OnlineAction() error
- func (u *User) Register(wc *WorldController) error
- func (u *User) Send(m *websocket.PreparedMessage)
- func (u *User) SendHighFiveStats(target *User) error
- func (u *User) SwitchWorld(newWorldId uuid.UUID) error
- func (u *User) Unregister(h *WorldController) error
- func (u *User) UpdatePosition(data []byte)
- type WorldController
- func (wc *WorldController) AddUserToWorld(u *User) error
- func (wc *WorldController) Broadcast(websocketMessage *websocket.PreparedMessage)
- func (wc *WorldController) GetBuilder() *message.Builder
- func (wc *WorldController) GetConfig() *config.World
- func (wc *WorldController) GetExtensionStorage() string
- func (wc *WorldController) GetID() uuid.UUID
- func (wc *WorldController) GetSpacePosition(id uuid.UUID) (cmath.Vec3, error)
- func (wc *WorldController) GetSpacePresent(id uuid.UUID) bool
- func (wc *WorldController) GetStorage() *storage.Database
- func (wc *WorldController) InsertOnline(id uuid.UUID) error
- func (wc *WorldController) InsertWorldDynamicMembership(id uuid.UUID) error
- func (wc *WorldController) LoadExtensions() error
- func (wc *WorldController) PositionRelativeToAbsolute(spaceID uuid.UUID, v cmath.Vec3) (cmath.Vec3, error)
- func (wc *WorldController) ProcessEmoji(emoji string, pos *cmath.Vec3) (bool, cmath.Vec3)
- func (wc *WorldController) SafeSubscribe(topic string, qos byte, callback mqtt.MessageHandler)
- func (wc *WorldController) SendSpaceData(spaceID uuid.UUID, u *User) error
- func (wc *WorldController) SendWorldData(u *User) error
- func (wc *WorldController) SetSpaceTitle(spaceId uuid.UUID, title string) error
- func (wc *WorldController) UpdateMeta() error
- func (wc *WorldController) UpdateOnlineBySpaceId(spaceId uuid.UUID) (int64, error)
- func (wc *WorldController) UpdateVibesBySpaceId(spaceId uuid.UUID) (int64, error)
- func (wc *WorldController) WriteInfluxPoint(point *influx_write.Point) error
- type WorldMeta
- type WowMetadata
Constants ¶
View Source
const MegaEmojiRadius = 100.0
View Source
const MegaEmojiTimeWindow = 10 * time.Second // time window for megaEmoji
View Source
const MegaEmojiTriggerCount = 10
Variables ¶
This section is empty.
Functions ¶
func TimeInformer ¶
func TimeInformer(client safemqtt.Client)
Types ¶
type ConnectedUsers ¶
type ConnectedUsers struct {
// contains filtered or unexported fields
}
func NewUsers ¶
func NewUsers(world *WorldController) *ConnectedUsers
func (*ConnectedUsers) Add ¶
func (cu *ConnectedUsers) Add(u *User)
func (*ConnectedUsers) Broadcast ¶
func (cu *ConnectedUsers) Broadcast(message *websocket.PreparedMessage)
func (*ConnectedUsers) BroadcastDisconnectedUsers ¶
func (cu *ConnectedUsers) BroadcastDisconnectedUsers()
func (*ConnectedUsers) BroadcastPositions ¶
func (cu *ConnectedUsers) BroadcastPositions()
func (*ConnectedUsers) BroadcastUsersUpdate ¶
func (cu *ConnectedUsers) BroadcastUsersUpdate()
func (*ConnectedUsers) Delete ¶
func (cu *ConnectedUsers) Delete(id uuid.UUID)
func (*ConnectedUsers) GetOnSpace ¶
func (cu *ConnectedUsers) GetOnSpace(spaceId uuid.UUID) []*User
func (*ConnectedUsers) Num ¶
func (cu *ConnectedUsers) Num() int
func (*ConnectedUsers) PerformBroadcast ¶
func (cu *ConnectedUsers) PerformBroadcast(message *websocket.PreparedMessage)
func (*ConnectedUsers) UserLeft ¶
func (cu *ConnectedUsers) UserLeft(userId uuid.UUID)
type ControllerHub ¶
type ControllerHub struct { Worlds *utils.SyncMap[uuid.UUID, *WorldController] DB *storage.Database SpaceStorage space.Storage WorldStorage world.Storage UserStorage user.Storage // contains filtered or unexported fields }
func NewControllerHub ¶
func NewControllerHub( cfg *config.Config, networking *net.Networking, msgBuilder *message.Builder, db *storage.Database, mqttClient safemqtt.Client, ) (*ControllerHub, error)
func (*ControllerHub) AddWorldController ¶
func (ch *ControllerHub) AddWorldController(worldID uuid.UUID) (*WorldController, error)
func (*ControllerHub) CancelCleanupSpace ¶ added in v0.2.0
func (ch *ControllerHub) CancelCleanupSpace(id uuid.UUID)
func (*ControllerHub) CancelCleanupUser ¶ added in v0.2.0
func (ch *ControllerHub) CancelCleanupUser(id uuid.UUID)
func (*ControllerHub) ChangeHandler ¶
func (*ControllerHub) CleanupOnlineUsers ¶ added in v0.2.0
func (ch *ControllerHub) CleanupOnlineUsers() error
func (*ControllerHub) CleanupSpace ¶ added in v0.2.0
func (ch *ControllerHub) CleanupSpace(id uuid.UUID) error
func (*ControllerHub) CleanupSpaceWithDelay ¶ added in v0.2.0
func (*ControllerHub) CleanupSpacesWithDelay ¶ added in v0.2.0
func (ch *ControllerHub) CleanupSpacesWithDelay() error
func (*ControllerHub) CleanupUser ¶ added in v0.2.0
func (ch *ControllerHub) CleanupUser(id uuid.UUID) error
func (*ControllerHub) CleanupUserWithDelay ¶ added in v0.2.0
func (*ControllerHub) CleanupUsersWithDelay ¶ added in v0.2.0
func (ch *ControllerHub) CleanupUsersWithDelay() error
func (*ControllerHub) GetNodeSettings ¶
func (ch *ControllerHub) GetNodeSettings() error
func (*ControllerHub) GetUserSpawnPoint ¶
func (*ControllerHub) GetWorldController ¶
func (ch *ControllerHub) GetWorldController(worldID uuid.UUID) (*WorldController, error)
func (*ControllerHub) HashUserID ¶ added in v0.3.0
func (ch *ControllerHub) HashUserID(userId uuid.UUID) string
func (*ControllerHub) NetworkRunner ¶
func (ch *ControllerHub) NetworkRunner()
TODO: this method never ends
func (*ControllerHub) UpdateTotalUsers ¶
func (ch *ControllerHub) UpdateTotalUsers()
TODO: this method never ends
func (*ControllerHub) WriteInfluxPoint ¶
func (ch *ControllerHub) WriteInfluxPoint(point *influx_write.Point) error
type EmojiMessage ¶ added in v0.3.0
type LoadedSpaces ¶
type LoadedSpaces struct { Time1 time.Duration Time2 time.Duration Time3 time.Duration Time4 time.Duration Time5 time.Duration Time6 time.Duration MetaTime time.Duration // contains filtered or unexported fields }
func (*LoadedSpaces) Add ¶
func (ls *LoadedSpaces) Add(obj *Space)
func (*LoadedSpaces) Delete ¶
func (ls *LoadedSpaces) Delete(spaceId uuid.UUID)
func (*LoadedSpaces) FindClosest ¶
func (*LoadedSpaces) GetPresent ¶
func (ls *LoadedSpaces) GetPresent(spaceId uuid.UUID) (*Space, bool)
func (*LoadedSpaces) Init ¶
func (ls *LoadedSpaces) Init()
func (*LoadedSpaces) Load ¶
func (ls *LoadedSpaces) Load(req *RegRequest) *Space
func (*LoadedSpaces) LoadFromEntry ¶
func (ls *LoadedSpaces) LoadFromEntry(req *RegRequest, entry map[string]interface{}) *Space
func (*LoadedSpaces) Num ¶
func (ls *LoadedSpaces) Num() int
type RegRequest ¶
type RegRequest struct {
// contains filtered or unexported fields
}
type Space ¶
func (*Space) AddSpaceTags ¶ added in v0.3.0
func (*Space) CalculateVibes ¶
func (*Space) GetObjectDef ¶ added in v0.1.17
func (s *Space) GetObjectDef() *websocket.PreparedMessage
func (*Space) GetOnlineUsers ¶
func (*Space) MQTTEffectsHandler ¶
func (*Space) MQTTMessageHandler ¶
func (*Space) RecursiveSendAllAttributes ¶
func (s *Space) RecursiveSendAllAttributes(connection *socket.Connection)
func (*Space) RecursiveSendAllStrings ¶
func (s *Space) RecursiveSendAllStrings(connection *socket.Connection)
func (*Space) RecursiveSendAllTextures ¶
func (s *Space) RecursiveSendAllTextures(connection *socket.Connection)
func (*Space) SendToUsersOnSpace ¶
func (s *Space) SendToUsersOnSpace(msg *websocket.PreparedMessage)
func (*Space) SetPosition ¶
func (*Space) UpdateChildren ¶
func (*Space) UpdateMeta ¶
func (*Space) UpdateMetaFromMap ¶
func (*Space) UpdateObjectDef ¶ added in v0.1.17
func (s *Space) UpdateObjectDef()
func (*Space) UpdatePosition ¶
func (*Space) UpdateSpace ¶
type User ¶
func (*User) AddUserTags ¶ added in v0.3.0
func (*User) CheckIfMegaMoji ¶ added in v0.3.0
func (*User) HandleEmoji ¶ added in v0.3.0
func (u *User) HandleEmoji(m *posbus.RelayToController) error
func (*User) HandleHighFive ¶
func (u *User) HandleHighFive(m *posbus.TriggerInteraction) error
func (*User) HandleSignals ¶
func (*User) HandleStake ¶
func (u *User) HandleStake(m *posbus.TriggerInteraction)
func (*User) InteractionHandler ¶
func (u *User) InteractionHandler(m *posbus.TriggerInteraction)
func (*User) MQTTMessageHandler ¶
func (*User) OfflineAction ¶ added in v0.2.0
func (*User) OnlineAction ¶ added in v0.2.0
func (*User) Register ¶
func (u *User) Register(wc *WorldController) error
func (*User) Send ¶
func (u *User) Send(m *websocket.PreparedMessage)
func (*User) SendHighFiveStats ¶ added in v0.3.0
func (*User) Unregister ¶
func (u *User) Unregister(h *WorldController) error
func (*User) UpdatePosition ¶
type WorldController ¶
type WorldController struct { ID uuid.UUID AdditionalExtensions map[string]extension.Extension MainExtension extension.Extension EffectsEmitter uuid.UUID Config config.World EmojiJournals *utils.SyncMap[string, *emojiJournal] // contains filtered or unexported fields }
WorldController ...
func (*WorldController) AddUserToWorld ¶
func (wc *WorldController) AddUserToWorld(u *User) error
func (*WorldController) Broadcast ¶
func (wc *WorldController) Broadcast(websocketMessage *websocket.PreparedMessage)
func (*WorldController) GetBuilder ¶
func (wc *WorldController) GetBuilder() *message.Builder
func (*WorldController) GetConfig ¶
func (wc *WorldController) GetConfig() *config.World
func (*WorldController) GetExtensionStorage ¶
func (wc *WorldController) GetExtensionStorage() string
func (*WorldController) GetID ¶ added in v0.1.16
func (wc *WorldController) GetID() uuid.UUID
func (*WorldController) GetSpacePosition ¶
func (*WorldController) GetSpacePresent ¶
func (wc *WorldController) GetSpacePresent(id uuid.UUID) bool
func (*WorldController) GetStorage ¶
func (wc *WorldController) GetStorage() *storage.Database
func (*WorldController) InsertOnline ¶
func (wc *WorldController) InsertOnline(id uuid.UUID) error
func (*WorldController) InsertWorldDynamicMembership ¶
func (wc *WorldController) InsertWorldDynamicMembership(id uuid.UUID) error
func (*WorldController) LoadExtensions ¶
func (wc *WorldController) LoadExtensions() error
func (*WorldController) PositionRelativeToAbsolute ¶
func (*WorldController) ProcessEmoji ¶ added in v0.3.0
ProcessEmoji : add emoji to the journal, remove from journal outdated entries calculate if there is a case for megaEmoji, and if it, returns true and average position of events inclided
func (*WorldController) SafeSubscribe ¶
func (wc *WorldController) SafeSubscribe(topic string, qos byte, callback mqtt.MessageHandler)
func (*WorldController) SendSpaceData ¶ added in v0.1.17
func (wc *WorldController) SendSpaceData(spaceID uuid.UUID, u *User) error
func (*WorldController) SendWorldData ¶ added in v0.1.17
func (wc *WorldController) SendWorldData(u *User) error
func (*WorldController) SetSpaceTitle ¶
func (wc *WorldController) SetSpaceTitle(spaceId uuid.UUID, title string) error
func (*WorldController) UpdateMeta ¶
func (wc *WorldController) UpdateMeta() error
func (*WorldController) UpdateOnlineBySpaceId ¶
func (wc *WorldController) UpdateOnlineBySpaceId(spaceId uuid.UUID) (int64, error)
func (*WorldController) UpdateVibesBySpaceId ¶
func (wc *WorldController) UpdateVibesBySpaceId(spaceId uuid.UUID) (int64, error)
func (*WorldController) WriteInfluxPoint ¶ added in v0.3.0
func (wc *WorldController) WriteInfluxPoint(point *influx_write.Point) error
type WowMetadata ¶
Click to show internal directories.
Click to hide internal directories.