rolert

package module
v0.0.0-...-a66781c Latest Latest
Warning

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

Go to latest
Published: May 12, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OPWelcome             = 1
	OPTextMessage         = 100
	OPCreateRoom          = 200
	OPUserJoin            = 210
	OPUserLeave           = 211
	OPDeleteRoom          = 212
	OPStatusChange        = 300
	OPReceiveOK           = 400
	OPReceiveUnauthorized = 401
	OPReceiveNotFound     = 404
)

Variables

This section is empty.

Functions

func Connect

func Connect(w http.ResponseWriter, r *http.Request)

func Contains

func Contains(slice interface{}, x interface{}) bool

Contains checks if a slice contains an element.

func CreateRoom

func CreateRoom(msg *chc.Message) chc.InitRoom

func DeleteRoom

func DeleteRoom(room *chc.Room, userid string)

func GetIndexOfVal

func GetIndexOfVal(slice interface{}, x interface{}) int

GetIndexOfVal returns the index of a value in a slice.

func HandleUserSecurity

func HandleUserSecurity(user chc.User, msg chc.Message) bool

HandleUserSecurity makes sure all protocols are followed and the user token is not stolen. Returns true if everything is OK.

func JoinRoom

func JoinRoom(user *chc.User, iroom chc.InitRoom) int

func LeaveRoom

func LeaveRoom(user *chc.User, roomid string)

func PolicyViolation

func PolicyViolation(c *websocket.Conn, message string) bool

PolicyViolation sends a close message to a connection and always returns false.

func RemoveIndex

func RemoveIndex(slice interface{}, i int) interface{}

func SendToUsers

func SendToUsers(users map[string]*chc.User, message chc.Message)

SendToUsers sends a message to certain websocket connections.

func Start

func Start(port string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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