connection

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: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConnectionTableName string

ConnectionTableName the name of dynamodb table

Functions

This section is empty.

Types

type Connection

type Connection struct {
	// ConnectionID request.RequestContext.ConnectionID
	PK           string `json:"pk"`
	ConnectionID string `json:"connectionID"`
	RoomID       string `json:"roomID"`
	Username     string `json:"username"`
}

Connection dynamodb record structure

func NewConnection

func NewConnection(connectionID string) *Connection

NewConnection new connection record

type Manager

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

Manager manage connection

func NewManager

func NewManager() (*Manager, error)

NewManager returns connection manager instance

func (*Manager) CreateRoom

func (m *Manager) CreateRoom(roomID string) (bool, error)

CreateRoom create room

func (*Manager) Disconnected

func (m *Manager) Disconnected(connectionID string) error

Disconnected cleanup records beside connection

func (*Manager) EnterRoom

func (m *Manager) EnterRoom(connID string, roomID string) error

EnterRoom update roomid

func (*Manager) FindConnection

func (m *Manager) FindConnection(connectionID string) (*Connection, error)

FindConnection find out connection record from table

func (*Manager) FindRoomMates

func (m *Manager) FindRoomMates(roomID string) ([]Connection, error)

FindRoomMates find all room mates

func (*Manager) NewConnection

func (m *Manager) NewConnection(connectionID string) error

NewConnection make new connection and store to table

func (*Manager) RetrieveRoomConnections

func (m *Manager) RetrieveRoomConnections(roomID string) ([]*Connection, error)

RetrieveRoomConnections retrieve connections at same room

type Room

type Room struct {
	// ConnectionID request.RequestContext.ConnectionID
	PK           string `json:"pk"`
	ConnectionID string `json:"connectionID"`
	RoomID       string `json:"roomID"`
}

Room dynamodb record structure

func NewRoom

func NewRoom(roomID string) *Room

NewRoom return table record struct

Jump to

Keyboard shortcuts

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