How to Attach Strophe With C#
if (webResponse.StatusCode == HttpStatusCode.OK) {
using (responseStream = webResponse.GetResponseStream()){
using (XmlTextReader xmlReader = new XmlTextReader(responseStream)){
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load(xmlReader);
xmlResponse = xmldoc;
xmlReader.Close();
}
responseStream.Close();
}
}
sb.Append("<body content='text/xml; charset=utf-8'");
sb.Append(" hold='1'");
sb.Append(" rid='" + RID.ToString() + "'");
sb.Append(" to='" + JabberServer + "'");
sb.Append(" secure='true'");
sb.Append(" wait='60'");
sb.Append(" xml:lang='en'");
sb.Append(" xmpp:version='1.0'");
sb.Append(" xmlns='http://jabber.org/protocol/httpbind'");
sb.Append(" xmlns:xmpp='urn:xmpp:xbosh'/>");
var encoded= Convert.ToBase64String(Encoding.UTF8.GetBytes(x + [Username] + x + [Password]));
sb.Append("<body rid='" + RID + "'");
sb.Append(" sid='" + SID + "'");
sb.Append(" xmlns='http://jabber.org/protocol/httpbind'>");
sb.Append("<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' ");
sb.Append(" mechanism='PLAIN'>");
sb.Append(encoded);
sb.Append("</auth>");
sb.Append("</body>");
sb.Append("<body rid='" + RID + "'");
sb.Append(" xmlns='http://jabber.org/protocol/httpbind'");
sb.Append(" sid='" + SID + "'");
sb.Append(" to='" + JabberServer + "'");
sb.Append(" xml:lang='en
sb.Append(" xmpp:restart='true'");
sb.Append(" xmlns:xmpp='urn:xmpp:xbosh'");
sb.Append("/>");
sb.Append("<body rid='" + RID + "'");
sb.Append(" sid='" + SID + "'");
sb.Append(" xmlns='http://jabber.org/protocol/httpbind'>");
sb.Append("<iq id='_bind_auth_2' type='set' xmlns='jabber:client'>");
sb.Append("<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>");
sb.Append("<resource>" + Resource + "</resource>");
sb.Append("</bind>");
sb.Append("</iq>");
sb.Append("</body>");
sb.Append("<body rid='" + RID + "'");
sb.Append(" sid='" + SID + "'");
sb.Append(" xmlns='http://jabber.org/protocol/httpbind'>");
sb.Append("<iq id='_session_auth_2' type='set' xmlns='jabber:client'>");
sb.Append("<session xmlns='urn:ietf:params:xml:ns:xmpp-session'/>");
sb.Append("</iq>");
sb.Append("</body>");
var conn = new Strophe.Connection('http://jabberserver.url/http-bind/');
conn.attach(JID, SID, RID, func);