conn

package
v0.0.0-...-5f9c45b Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitOtServer

func InitOtServer()

Types

type ConnEvent

type ConnEvent struct {
	Conn *Connection
	*Event
}

type Connection

type Connection struct {
	ID      string
	Session *Session
	Authed  bool
	Ws      *websocket.Conn
}

func NewConnection

func NewConnection(session *Session, ws *websocket.Conn) *Connection

func (*Connection) Broadcast

func (c *Connection) Broadcast(msg *Event)

func (*Connection) Handle

func (c *Connection) Handle() error

func (*Connection) ReadEvent

func (c *Connection) ReadEvent() (*Event, error)

func (*Connection) Send

func (c *Connection) Send(msg *Event) error

type Event

type Event struct {
	Name string      `json:"e"`
	Data interface{} `json:"d,omitempty"`
}

type Session

type Session struct {
	Connections map[*Connection]struct{}

	EventChan chan ConnEvent

	*ot.Session
	// contains filtered or unexported fields
}

func NewSession

func NewSession(document string) *Session

func (*Session) HandleEvents

func (s *Session) HandleEvents()

func (*Session) RegisterConnection

func (s *Session) RegisterConnection(c *Connection)

func (*Session) UnRegisterConnection

func (s *Session) UnRegisterConnection(c *Connection)

Jump to

Keyboard shortcuts

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