Documentation
¶
Index ¶
- type Client
- type ClientConfig
- type ClientSetOrientationMessage
- type Hub
- type Message
- func (m Message) ClientSetDisplayName() string
- func (m Message) ClientSetOrientation() (ClientSetOrientationMessage, error)
- func (m Message) ClientSetScene() json.RawMessage
- func (m Message) ClientSetSceneData() WebScene
- func (m Message) ServerRoomStateUpdate() RoomState
- func (m Message) SeverSetClientID() string
- func (m Message) Write(out io.Writer) error
- type MessageType
- type Player
- type PlayerRepresentation
- type RoomState
- type Vec3
- type Vec4
- type WebScene
- type WebSceneFog
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { // config Config *ClientConfig // contains filtered or unexported fields }
Client is a middleman between the websocket connection and the hub.
type ClientConfig ¶ added in v0.11.0
type ClientConfig struct { // Time allowed to write a message to the peer. WriteWait time.Duration // Time allowed to read the next pong message from the peer. PongWait time.Duration // Send pings to peer with this period. Must be less than pongWait. PingPeriod time.Duration // Maximum message size allowed from peer. MaxMessageSize int64 }
func DefaultClientConfig ¶ added in v0.11.0
func DefaultClientConfig() *ClientConfig
type ClientSetOrientationMessage ¶
type ClientSetOrientationMessage struct {
Objects []PlayerRepresentation
}
type Hub ¶
type Hub struct { ClientConfig *ClientConfig // contains filtered or unexported fields }
Hub maintains the set of active clients and broadcasts messages to the clients.
func (*Hub) ServeWs ¶
func (hub *Hub) ServeWs(w http.ResponseWriter, r *http.Request, clientConfig *ClientConfig)
serveWs handles websocket requests from the peer.
type Message ¶
type Message struct { Type MessageType Data []byte }
func MessageFromClient ¶ added in v0.11.0
func ServerRoomStateUpdate ¶ added in v0.11.0
func SeverSetClientIDMessage ¶ added in v0.11.0
func (Message) ClientSetDisplayName ¶ added in v0.11.0
func (Message) ClientSetOrientation ¶ added in v0.11.0
func (m Message) ClientSetOrientation() (ClientSetOrientationMessage, error)
func (Message) ClientSetScene ¶ added in v0.11.0
func (m Message) ClientSetScene() json.RawMessage
func (Message) ClientSetSceneData ¶
func (Message) ServerRoomStateUpdate ¶ added in v0.11.0
func (Message) SeverSetClientID ¶ added in v0.11.0
type MessageType ¶
type MessageType byte
const ( ClientSetOrientationMessageType MessageType = 0 ClientSetDisplayNameMessageType MessageType = 1 ClientSetSceneMessageType MessageType = 2 ClientSetPointerMessageType MessageType = 3 ClientRemovePointerMessageType MessageType = 4 ServerSetClientIDMessageType MessageType = 0 + 128 ServerRoomStateUpdateMessageType MessageType = 1 + 128 ServerRefrershGeneratorMessageType MessageType = 2 + 128 ServerBroadcastMessageType MessageType = 3 + 128 )
type Player ¶
type Player struct { Name string `json:"name"` Representation []PlayerRepresentation `json:"representation"` }
type PlayerRepresentation ¶ added in v0.11.0
type WebScene ¶
type WebScene struct { RenderWireframe bool `json:"renderWireframe"` AntiAlias bool `json:"antiAlias"` XrEnabled bool `json:"xrEnabled"` Fog WebSceneFog `json:"fog"` Background coloring.WebColor `json:"background"` Lighting coloring.WebColor `json:"lighting"` Ground coloring.WebColor `json:"ground"` }
func DefaultWebScene ¶
func DefaultWebScene() *WebScene
Click to show internal directories.
Click to hide internal directories.