web_socket

package
v0.0.0-...-71ffa5d Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BattleService

func BattleService(ws *websocket.Conn, gameUser *user.User, req Request)

func HandleConnections

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

func InitNodeChecker

func InitNodeChecker()

func LobbyService

func LobbyService(ws *websocket.Conn, gameUser *user.User, req Request)

func ReadSocket

func ReadSocket(id int, w http.ResponseWriter, r *http.Request)

func Reader

func Reader(ws *websocket.Conn, gameUser *user.User)

func SendMessage

func SendMessage(message web_socket_response.Response)

func Sender

func Sender()

func SystemService

func SystemService(ws *websocket.Conn, gameUser *user.User, req Request)

Types

type GameLoopMessages

type GameLoopMessages struct {
	Messages []web_socket_response.Response
	// contains filtered or unexported fields
}

func (*GameLoopMessages) AddMessage

func (m *GameLoopMessages) AddMessage(msg web_socket_response.Response)

type MessagesGroup

type MessagesGroup struct {
	Key        string            `json:"key"`
	Messages   *GameLoopMessages `json:"messages"`
	Type       string            `json:"type"` // move - проверяем функцией "moveMessagesToUser", view - "ResponseToBin"
	Attributes map[string]string `json:"attributes"`
}

type MessagesStore

type MessagesStore struct {
	// contains filtered or unexported fields
}

func (*MessagesStore) AddMsg

func (ms *MessagesStore) AddMsg(typeMsg, typeCheck string, msg web_socket_response.Response, attributes map[string]string)

func (*MessagesStore) Clear

func (ms *MessagesStore) Clear()

func (*MessagesStore) GetMessageGroups

func (ms *MessagesStore) GetMessageGroups() []*MessagesGroup

type Request

type Request struct {
	Event       string `json:"event,omitempty"`
	Service     string `json:"service,omitempty"`
	ID          int    `json:"id,omitempty"`
	X           int    `json:"x"`
	Y           int    `json:"y"`
	SelectUnits []int  `json:"select_units,omitempty"`
	W           bool   `json:"w"`
	A           bool   `json:"a"`
	S           bool   `json:"s"`
	D           bool   `json:"d"`
	Z           bool   `json:"z"`
	Sp          bool   `json:"sp"`
	St          bool   `json:"st"`
	Fire        bool   `json:"fire"`
}

Jump to

Keyboard shortcuts

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