sessions

package
v0.0.0-...-937b28e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 28, 2022 License: GPL-3.0 Imports: 3 Imported by: 3

Documentation

Overview

Package sessions provides functions to help maintain consistency across multiple websocket connections from a single player, when the player has multiple tabs/windows open (since each tab opens a new websocket connection)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSocket

func AddSocket(steamid string, so *wsevent.Client)

AddSocket adds so to the list of sockets connected from steamid

func AfterDisconnectedFunc

func AfterDisconnectedFunc(steamid string, d time.Duration, f func())

AfterDisconnectedFunc waits the duration to elapse, and if the player with the given steamid is still disconnected, calls f in it's own goroutine.

func ConnectedSockets

func ConnectedSockets(steamid string) int

ConnectedSockets returns the number of socket connections from steamid

func GetSockets

func GetSockets(steamid string) (sockets []*wsevent.Client, success bool)

GetSockets returns a list of sockets connected from steamid. The second return value is false if they player has no sockets connected

func GetSpectating

func GetSpectating(socketID string) (lobbyID uint, ok bool)

GetSpectating returns the lobbyID of the lobby the socketID is currently spectating. ok is false if the socket is not spectating any lobby

func IsConnected

func IsConnected(steamid string) bool

IsConnected returns whether the given steamid is connected to the website

func IsSpectating

func IsSpectating(socketID string, lobbyID uint) bool

IsSpectating returns whether socketID is spectating lobbyID

func RemoveSocket

func RemoveSocket(sessionID, steamID string)

RemoveSocket removes so from the list of sockets connected from steamid

func RemoveSpectator

func RemoveSpectator(socketID string)

RemoveSpectator indicates that socketID is no longer spectating the lobby it was earlier.

func SetSpectator

func SetSpectator(socketID string, lobbyID uint)

SetSpectator indicates that the socket with the given socketID is now spectating lobbyID

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL