97 |
97 |
98 // Connect to the appropriate server and authenticate as the given JID |
98 // Connect to the appropriate server and authenticate as the given JID |
99 // with the given password. This function will return as soon as a TCP |
99 // with the given password. This function will return as soon as a TCP |
100 // connection has been established, but before XMPP stream negotiation |
100 // connection has been established, but before XMPP stream negotiation |
101 // has completed. The negotiation will occur asynchronously, and any |
101 // has completed. The negotiation will occur asynchronously, and any |
102 // send operation to Client.Out will block until negotiation (resource |
102 // send operation to Client.Send will block until negotiation |
103 // binding) is complete. |
103 // (resource binding) is complete. The caller must immediately start |
|
104 // reading from Client.Recv. |
104 func NewClient(jid *JID, password string, tlsconf tls.Config, exts []Extension) (*Client, error) { |
105 func NewClient(jid *JID, password string, tlsconf tls.Config, exts []Extension) (*Client, error) { |
105 // Include the mandatory extensions. |
106 // Include the mandatory extensions. |
106 roster := newRosterExt() |
107 roster := newRosterExt() |
107 exts = append(exts, roster.Extension) |
108 exts = append(exts, roster.Extension) |
108 exts = append(exts, bindExt) |
109 exts = append(exts, bindExt) |