Documentation
¶
Overview ¶
the core package provides basic functionality to all the major components of the code
Index ¶
- type BlockingMockEventChannel
- type DefaultEvent
- func (e *DefaultEvent) ID() string
- func (e *DefaultEvent) SetID(id string)
- func (e *DefaultEvent) SetType(t string)
- func (e *DefaultEvent) SetUser(id string)
- func (e *DefaultEvent) SetValue(v any)
- func (e *DefaultEvent) Type() string
- func (e *DefaultEvent) User() string
- func (e *DefaultEvent) Value() any
- type DefaultEventChannel
- type Event
- type EventChannel
- type MockEventChannel
- func (ec *MockEventChannel) Close() error
- func (ec *MockEventChannel) GetRoomID() string
- func (ec *MockEventChannel) ID() string
- func (ec *MockEventChannel) OnConnect()
- func (ec *MockEventChannel) ReceiveEvent() (Event, error)
- func (ec *MockEventChannel) SendEvent(evt Event) error
- func (ec *MockEventChannel) SetRoomID(s string)
- type TwoWayMockEventChannel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockingMockEventChannel ¶
type BlockingMockEventChannel struct {
*MockEventChannel
// contains filtered or unexported fields
}
BlockingMockEventChannel essentially does the same thing as a MockEventChannel except when it's out of QueuedEvents then it just blocks until Disconnect() is called.
func NewBlockingMockEventChannel ¶
func NewBlockingMockEventChannel() *BlockingMockEventChannel
func (*BlockingMockEventChannel) Disconnect ¶
func (ec *BlockingMockEventChannel) Disconnect()
func (*BlockingMockEventChannel) OnConnect ¶
func (ec *BlockingMockEventChannel) OnConnect()
func (*BlockingMockEventChannel) Ready ¶
func (ec *BlockingMockEventChannel) Ready() <-chan bool
func (*BlockingMockEventChannel) ReceiveEvent ¶
func (ec *BlockingMockEventChannel) ReceiveEvent() (Event, error)
type DefaultEvent ¶
type DefaultEvent struct {
EventType string `json:"event"`
EventValue any `json:"value"`
EventUserID string `json:"userid"`
EventID string `json:"eventid"`
}
Event is the basic struct for sending and receiving messages over the websockets
func (*DefaultEvent) ID ¶
func (e *DefaultEvent) ID() string
func (*DefaultEvent) SetID ¶
func (e *DefaultEvent) SetID(id string)
func (*DefaultEvent) SetType ¶
func (e *DefaultEvent) SetType(t string)
func (*DefaultEvent) SetUser ¶
func (e *DefaultEvent) SetUser(id string)
func (*DefaultEvent) SetValue ¶
func (e *DefaultEvent) SetValue(v any)
func (*DefaultEvent) Type ¶
func (e *DefaultEvent) Type() string
func (*DefaultEvent) User ¶
func (e *DefaultEvent) User() string
func (*DefaultEvent) Value ¶
func (e *DefaultEvent) Value() any
type DefaultEventChannel ¶
type DefaultEventChannel struct {
// contains filtered or unexported fields
}
DefaultEventChannel is a thin wrapper around a ReadWriteCloser
func (*DefaultEventChannel) Close ¶
func (ec *DefaultEventChannel) Close() error
func (*DefaultEventChannel) ID ¶
func (ec *DefaultEventChannel) ID() string
func (*DefaultEventChannel) OnConnect ¶
func (ec *DefaultEventChannel) OnConnect()
func (*DefaultEventChannel) ReceiveEvent ¶
func (ec *DefaultEventChannel) ReceiveEvent() (Event, error)
func (*DefaultEventChannel) SendEvent ¶
func (ec *DefaultEventChannel) SendEvent(evt Event) error
type Event ¶
type Event interface {
Type() string
Value() any
User() string
ID() string
SetType(string)
SetValue(any)
SetUser(string)
SetID(string)
}
func EmptyEvent ¶
func EmptyEvent() Event
func EventFromJSON ¶
func FrameEvent ¶
type EventChannel ¶
type EventChannel interface {
SendEvent(evt Event) error
ReceiveEvent() (Event, error)
OnConnect()
Close() error
ID() string
}
func NewDefaultEventChannel ¶
func NewDefaultEventChannel(ws io.ReadWriteCloser) EventChannel
type MockEventChannel ¶
type MockEventChannel struct {
QueuedEvents []Event
SavedEvents []Event
Closed bool
// contains filtered or unexported fields
}
func NewMockEventChannel ¶
func NewMockEventChannel() *MockEventChannel
func (*MockEventChannel) Close ¶
func (ec *MockEventChannel) Close() error
func (*MockEventChannel) GetRoomID ¶
func (ec *MockEventChannel) GetRoomID() string
func (*MockEventChannel) ID ¶
func (ec *MockEventChannel) ID() string
func (*MockEventChannel) OnConnect ¶
func (ec *MockEventChannel) OnConnect()
func (*MockEventChannel) ReceiveEvent ¶
func (ec *MockEventChannel) ReceiveEvent() (Event, error)
func (*MockEventChannel) SendEvent ¶
func (ec *MockEventChannel) SendEvent(evt Event) error
func (*MockEventChannel) SetRoomID ¶
func (ec *MockEventChannel) SetRoomID(s string)
type TwoWayMockEventChannel ¶
type TwoWayMockEventChannel struct {
*BlockingMockEventChannel
// contains filtered or unexported fields
}
func NewTwoWayMockEventChannel ¶
func NewTwoWayMockEventChannel() *TwoWayMockEventChannel
func (*TwoWayMockEventChannel) Disconnect ¶
func (ec *TwoWayMockEventChannel) Disconnect()
func (*TwoWayMockEventChannel) Flush ¶
func (ec *TwoWayMockEventChannel) Flush()
func (*TwoWayMockEventChannel) ReceiveEvent ¶
func (ec *TwoWayMockEventChannel) ReceiveEvent() (Event, error)
func (*TwoWayMockEventChannel) SendEvent ¶
func (ec *TwoWayMockEventChannel) SendEvent(evt Event) error
func (*TwoWayMockEventChannel) SimulateEvent ¶
func (ec *TwoWayMockEventChannel) SimulateEvent(evt Event)
Click to show internal directories.
Click to hide internal directories.