Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

This branch is 2 commits ahead, 42 commits behind metajack:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

..
Failed to load latest commit information.
lib
spec
Cakefile
README.markdown
strophe.joap.coffee
strophe.joap.js

README.markdown

Jabber Object Access Protocol

A strophe plugin for the Jabber Object Access Protocol (XEP-0075).

Usage

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.

Server

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) ->

Class

aClass = new connection.joap.JOAPClass "myClass@component.example.org"

# requesting a class description
aClass.describe (iq, err, parsedDescription) ->

# creating a new instance
aClass.add { aProperty:"aValue" }, (iq, err, instanceAddress) ->

Object

obj = new connection.joap.JOAPObject "myClass@component.example.org/instanceId"

# modifying properties
obj.edit { key: 'value' }, (iq, err) ->

Dependencies

Available JOAP server implementations

ToDos

  • RPC support

Tests & specs

jasmine-node and jsdom are required (npm install -g jasmine-node jsdom) for running the tests.

cake test
Something went wrong with that request. Please try again.