More useful docs for Stream and XMPP.
This commit is contained in:
parent
6416a5e1ee
commit
ec1eaf94b9
|
|
@ -20,8 +20,8 @@ type Stream struct {
|
||||||
dec *xml.Decoder
|
dec *xml.Decoder
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a XML stream connection. Typically handles the encoding and decoding
|
// Create a XML stream connection. A Steam is used by an XMPP instance to
|
||||||
// of XML data for a higher-level API, e.g. XMPP.
|
// handle sending and receiving XML data over the net connection.
|
||||||
func NewStream(addr string) (*Stream, error) {
|
func NewStream(addr string) (*Stream, error) {
|
||||||
|
|
||||||
log.Println("Connecting to", addr)
|
log.Println("Connecting to", addr)
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,11 @@ package xmpp
|
||||||
|
|
||||||
import "log"
|
import "log"
|
||||||
|
|
||||||
|
// Handles XMPP conversations over a Stream. Use NewClientXMPP and/or
|
||||||
|
// NewComponentXMPP to create and configuring a XMPP instance.
|
||||||
type XMPP struct {
|
type XMPP struct {
|
||||||
|
// JID associated with the stream. Note: this may be negotiated with the
|
||||||
|
// server during setup and so must be used for all messages.
|
||||||
JID JID
|
JID JID
|
||||||
stream *Stream
|
stream *Stream
|
||||||
in chan interface{}
|
in chan interface{}
|
||||||
|
|
@ -21,6 +25,7 @@ func newXMPP(jid JID, stream *Stream) *XMPP {
|
||||||
return x
|
return x
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Send a stanza.
|
||||||
func (x *XMPP) Send(v interface{}) {
|
func (x *XMPP) Send(v interface{}) {
|
||||||
x.out <- v
|
x.out <- v
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue