Documentation ¶
Index ¶
- type Channel
- func (channel *Channel) CanPush() bool
- func (channel *Channel) ChannelLeave() error
- func (channel *Channel) ForceReconnect() error
- func (channel *Channel) IsOpen() bool
- func (channel *Channel) Join(payload interface{}) *Channel
- func (channel *Channel) Leave()
- func (channel *Channel) Observe() (data interface{}, err error)
- func (channel *Channel) Push(event string, payload interface{}) error
- func (channel *Channel) RawPush(event string, payload interface{})
- func (channel *Channel) Read() MessageResponse
- func (channel *Channel) Reconnect()
- func (channel *Channel) Register(event Event, callback ChannelCallbackFunc) error
- func (channel *Channel) UnRegister(event Event) error
- type ChannelCallbackFunc
- type Client
- type Event
- type ExecutionAction
- type Message
- type MessageResponse
- type Payload
- type PheonixGoSocket
- func (phx *PheonixGoSocket) CloseChannel(topic string) error
- func (phx *PheonixGoSocket) ClosePheonixWebsocket()
- func (phx *PheonixGoSocket) GetChannel(topic string) (*Channel, error)
- func (phx *PheonixGoSocket) JoinChannel(topic string, payload interface{}) error
- func (phx PheonixGoSocket) Listen() error
- func (phx *PheonixGoSocket) OpenChannel(topic string) (*Channel, error)
- func (phx *PheonixGoSocket) SetCustomTimeout(interval time.Duration)
- type PhxGoSocketStatus
- type State
- type Status
- type Transport
- type Worker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel struct { State State Topic string InitialPayload interface{} Client Client RefCount int64 Events map[Event]ChannelCallbackFunc DataBuffer map[string]interface{} }
func (*Channel) ChannelLeave ¶
func (*Channel) ForceReconnect ¶
func (*Channel) Read ¶
func (channel *Channel) Read() MessageResponse
func (*Channel) Register ¶
func (channel *Channel) Register(event Event, callback ChannelCallbackFunc) error
func (*Channel) UnRegister ¶
type ChannelCallbackFunc ¶
type ChannelCallbackFunc func(response MessageResponse) (data interface{}, err error)
type Event ¶
type Event string
const ( // MessageEvent represents a regular message on a topic. MessageEvent Event = "phx_message" // JoinEvent represents a successful join on a channel. JoinEvent Event = "phx_join" // CloseEvent represents the closing of a channel. CloseEvent Event = "phx_close" // ErrorEvent represents an error. ErrorEvent Event = "phx_error" // ReplyEvent represents a reply to a message sent on a topic. ReplyEvent Event = "phx_reply" // LeaveEvent represents leaving a channel and unsubscribing from a topic. LeaveEvent Event = "phx_leave" )
func (Event) EventToString ¶
type ExecutionAction ¶
type ExecutionAction func()
type MessageResponse ¶
type Payload ¶
type Payload struct { Status string `json:"status"` Response interface{} `json:"response"` }
type PheonixGoSocket ¶
type PheonixGoSocket struct { Host string Schema string Path string RawQuery string Status PhxGoSocketStatus Timeout time.Duration CustomAbsoultePath bool Transport Transport HeartbeatWorker *Worker Channels map[string]*Channel }
func NewPheonixWebsocket ¶
func NewPheonixWebsocket(Host string, Path string, Schema string, CustomAbsoultePath bool, RawQuery string) PheonixGoSocket
Creates New Pheonix Websocket connection
func (*PheonixGoSocket) CloseChannel ¶
func (phx *PheonixGoSocket) CloseChannel(topic string) error
func (*PheonixGoSocket) ClosePheonixWebsocket ¶
func (phx *PheonixGoSocket) ClosePheonixWebsocket()
func (*PheonixGoSocket) GetChannel ¶
func (phx *PheonixGoSocket) GetChannel(topic string) (*Channel, error)
Raw access for a channel
func (*PheonixGoSocket) JoinChannel ¶
func (phx *PheonixGoSocket) JoinChannel(topic string, payload interface{}) error
func (PheonixGoSocket) Listen ¶
func (phx PheonixGoSocket) Listen() error
Starts the Pheonix Websocket
func (*PheonixGoSocket) OpenChannel ¶
func (phx *PheonixGoSocket) OpenChannel(topic string) (*Channel, error)
func (*PheonixGoSocket) SetCustomTimeout ¶
func (phx *PheonixGoSocket) SetCustomTimeout(interval time.Duration)
Set your timeout intervel and heartbeat interval in format (interval * Duration) e.g (30 * time.Seconds)
type PhxGoSocketStatus ¶
type PhxGoSocketStatus string
const ( PhxGoOpen PhxGoSocketStatus = "open" PhxGoError PhxGoSocketStatus = "error" PhxGoClosed PhxGoSocketStatus = "closed" )
type Worker ¶
type Worker struct { Stopped bool // A flag determining the state of the worker ShutdownChannel chan string // A channel to communicate to the routine Interval time.Duration // The interval with which to run the Action // contains filtered or unexported fields }
func (*Worker) Action ¶
func (w *Worker) Action(action ExecutionAction)
Click to show internal directories.
Click to hide internal directories.