socket

package
v0.0.0-...-1b1d3ba Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TypeConnected connected evetns
	TypeConnected = "connected"
	// TypeRoomCreated room created event. body is containing created room id
	TypeRoomCreated = "room-created"
	// TypeEnter enter room event.
	TypeEnter = "enter"
	// TypeLeave leave room event.
	TypeLeave = "leave"
	// TypeNewRoomMate new room mate joining event
	TypeNewRoomMate = "new-room-mate"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EnterRoomMessageFrame

type EnterRoomMessageFrame struct {
	// should be enter
	Type         string `json:"type"`
	RoomID       string `json:"roomID"`
	ConnectionID string `json:"connectionID"`
}

EnterRoomMessageFrame ...

type MessageFrame

type MessageFrame struct {
	Type string `json:"type"`
	Data string `json:"body"`
	From string `json:"from"`
}

MessageFrame message frame for transfer

type Socket

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

Socket apigateway client wrapper

func New

func New(endpoint string) (*Socket, error)

New make dynamodb session

func (*Socket) Multicast

func (s *Socket) Multicast(message *MessageFrame, conns []*connection.Connection) error

Multicast data to connections

func (*Socket) SendMessage

func (s *Socket) SendMessage(connID string, message *MessageFrame) error

SendMessage send a message

func (*Socket) SendRoomCreated

func (s *Socket) SendRoomCreated(connectionID, roomID string) error

SendRoomCreated notify room created event

func (*Socket) SendRoomEntered

func (s *Socket) SendRoomEntered(destID, newConnID, roomID string) error

SendRoomEntered notify room created event

func (*Socket) SendRoomLeave

func (s *Socket) SendRoomLeave(destID, leftConnID, roomID string) error

SendRoomLeave notify room leave

Jump to

Keyboard shortcuts

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