Documentation
¶
Index ¶
- Constants
- type Chan
- func (ch *Chan) GetRef() string
- func (ch *Chan) Join() (*Puller, error)
- func (ch *Chan) Leave() (*Puller, error)
- func (ch *Chan) OnEvent(evt string) *Puller
- func (ch *Chan) OnMessage() *Puller
- func (ch *Chan) Push(evt string, payload interface{}) error
- func (ch *Chan) PushWithRef(ref, evt *string, payload interface{}) error
- func (ch *Chan) Request(evt string, payload interface{}) (*Puller, error)
- type Connection
- type Message
- type Puller
- type Socket
- type WSocket
Constants ¶
View Source
const ( // ChClosed channel closed ChClosed = "closed" // ChErrored channel errored ChErrored = "errored" // ChJoined channel joined ChJoined = "joined" // ChJoing channel joining ChJoing = "joining" // ChanClose channel close event ChanClose = "phx_close" // ChanError channel error event ChanError = "phx_error" // ChanReply server reply event ChanReply = "phx_reply" // ChanJoin client send join event ChanJoin = "phx_join" // ChanLeave client send leave event ChanLeave = "phx_leave" )
View Source
const ( // ConnConnecting linter ConnConnecting = "connecting" // ConnOpen linter ConnOpen = "open" // ConnClosing linter ConnClosing = "closing" // Connclosed linter Connclosed = "closed" )
View Source
const VSN = "1.0.0"
VSN linter
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chan ¶
type Chan struct {
// contains filtered or unexported fields
}
Chan channel
func (*Chan) PushWithRef ¶
PushWithRef send a msg to channel
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection handle phoenix connection
func Connect ¶
func Connect(_url string, args url.Values) (*Connection, error)
Connect need to call first, auto reconnect if failed
func (*Connection) Chan ¶
func (conn *Connection) Chan(topic string) (*Chan, error)
Chan create a new channel on connection
func (*Connection) OnMessage ¶
func (conn *Connection) OnMessage() *Puller
OnMessage receive all message on connection
type Message ¶
type Message struct { Topic string `json:"topic"` Event string `json:"event"` Ref string `json:"ref"` Payload interface{} `json:"payload"` }
Message message
type Puller ¶
type Puller struct {
// contains filtered or unexported fields
}
Puller channel to receive result
type Socket ¶
type Socket interface { Connect(_url string, args url.Values) error Send(*Message) error Recv() (*Message, error) Close() error }
Socket interface for easy test
Source Files
¶
Click to show internal directories.
Click to hide internal directories.