websocket

package
v0.0.0-...-5c4fd57 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoConnection = errors.New("websocket: no connection found for user")

Functions

This section is empty.

Types

type FriendStatus

type FriendStatus struct {
	Type              string `json:"type"`              // Can ber either REQUEST, ACCEPTED, or REMOVED
	UserID            string `json:"userID"`            // The user ID of the friend
	Username          string `json:"username"`          // The username of the friend
	ProfilePictureURL string `json:"profilePictureURL"` // The profile picture URL of the friend
}

type WebsocketClient

type WebsocketClient struct {
	Status string
	Conn   *websocket.Conn
}

type WebsocketMessage

type WebsocketMessage struct {
	Type string `json:"type"`
	Data any    `json:"data"`
}

type WebsocketServer

type WebsocketServer struct {
	Connections       map[string]WebsocketClient
	AccessTokenSecret string
	DB                *pgxpool.Pool
}

func (*WebsocketServer) NewWebsocket

func (ws *WebsocketServer) NewWebsocket() func(*fiber.Ctx) error

func (*WebsocketServer) UpdateFriendStatus

func (ws *WebsocketServer) UpdateFriendStatus(recipientID string, status FriendStatus) error

func (*WebsocketServer) WebsocketUpgrade

func (ws *WebsocketServer) WebsocketUpgrade(c *fiber.Ctx) error

Jump to

Keyboard shortcuts

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