A strophe plugin for the Jabber Object Access Protocol (XEP-0075).
Link the rpc
, jid
and the joap
plugin below the strophe library in your
HTML head section:
<head>
<!-- ... -->
<script type="text/javascript" src="strophe.min.js"></script>
<script type="text/javascript" src="jid.js"></script>
<script type="text/javascript" src="strophe.disco.js"></script>
<script type="text/javascript" src="strophe.rpc.js"></script>
<script type="text/javascript" src="strophe.joap.js"></script>
<!-- ... -->
</head>
After your client is sucessfully connected you can create, read, update and delete objects.
objectServer = new connection.joap.JOAPServer "component.example.org"
# requesting the server description
objectServer.describe (iq, err, parsedDescription) ->
# requesting a class description
objectServer.describe "User", (iq, err, parsedDescription) ->
# creating a new instance
objectServer.add "User", { name:"My Name", age: 99 }, (iq, err, instanceAddress) ->
# reading an instance
objectServer.read "User", "instanceId", (iq, err, parsedResult) ->
# reading only a few properties of an instance
objectServer.read "User", "instanceId", ["email", "age"], (iq, err, parsedResult) ->
# modifying properties of an instance
objectServer.edit "User", "instanceId", { age: 27 }, (iq, err) ->
# deleting an instance
objectServer.delete "User", "instanceId", (iq, err) ->
# searching for instances
objectServer.search "User", {age: 60} , (iq, err, arrayOfInstanceIDs) ->
# searching and reading in one step
objectServer.searchAndRead "User", {type: "admin"}, ["email"], (iq, err, arrayOfInstancObjects) ->
# performing a method call
objectServer.methodCall "myMethod", "User", ["param1","param2"], (iq, err, result) ->
aClass = new connection.joap.JOAPClass "[email protected]"
# requesting a class description
aClass.describe (iq, err, parsedDescription) ->
# searching for class instances
aClass.search (iq, err, arrayOfInstanceIDs) ->
# searching and reading
aClass.searchAndRead filter, limits, (iq, err, arrayOfInstances) ->
# creating a new instance
aClass.add { aProperty:"aValue" }, (iq, err, instanceAddress) ->
obj = new connection.joap.JOAPObject "[email protected]/instanceId"
# modifying properties
obj.edit { key: 'value' }, (iq, err) ->
- jid.js
- rpc
- punycode (optional)
- service discovery (optional)
buster.js and
buster-coffee and
are required (npm install -g buster buster-coffee
) for running the tests.
First start a test server
buster server
Then navigate with one or more browsers to localhost:1111
and capture them.
Afterwards you can run the specs:
cake test