What is strophe and how to use it with JQuery?

2020-06-03 03:38发布

Can somebody explain what strophe is?

I believe it has something to do with XMPP?

How can I incorporate it into a site using Jquery?

4条回答
爱情/是我丢掉的垃圾
2楼-- · 2020-06-03 03:53

Strophe is not a Jabber Client, and its not an XMPP client. Its a library that allows you to easily write either of these. You could (with great difficulty) write a Jabber/XMPP Client from scratch using Javascript or Jquery, but this would be very difficult imagine generating and sending XML like this:

<body xmlns='http://jabber.org/protocol/httpbind' sid='e4fcc09444a61059e88296a106e86e1ff1454f9b' wait='60' requests='2' inactivity='30' maxpause='120' polling='2' ver='1.8' from='localhost' secure='true' authid='1027072784' xmlns:xmpp='urn:xmpp:xbosh' xmlns:stream='http://etherx.jabber.org/streams' xmpp:version='1.0'><stream:features xmlns:stream='http://etherx.jabber.org/streams'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>

Strophe is a library of Javascript functions that makes the process of writing an XMPP client easier. It has methods to allow you to connect to a server, to send a message to a user, to add a contact - and it knows about the XML that needs to be sent to the server to carry out these actions. It basically does all the difficult stuff - the XML generating, sending, connecting and communicating stuff for you. Which makes your life a whole lot easier.

查看更多
我只想做你的唯一
3楼-- · 2020-06-03 04:08

Strophe already uses jQuery. In fact, the Strophe builder APIs borrow the $() syntax from jQuery. Take a look at the echobot example that comes with the source. Definitely check out the Strophe Google group (http://groups.google.com/group/strophe), where you would find Jack Moffitt (creator of Strophe) promptly answers questions himself.

查看更多
兄弟一词,经得起流年.
4楼-- · 2020-06-03 04:19

Strophe is a XMPP client, written in Javascript. More specifically, it is a Javascript library that lets you write real-time web applications that have full XMPP capabilities. It is "real-time" because is uses a "Comet-like" technique known as "BOSH" http://xmpp.org/extensions/xep-0124.html.

Once you learn the basics of Strophe, using it with jQuery will "just work" as there is no conflicting code, named functions, or dependencies.

查看更多
成全新的幸福
5楼-- · 2020-06-03 04:19

The API documentation for the library can be found here -> str<>phe API

It's a javascript library that's separate to jQuery but obviously you can call any javascript library from any other so I don't believe you'll have any requirement for a specific jQuery integration.

查看更多
登录 后发表回答