{link:Jabber-RPC|http://www.jabber.org/jeps/jep-0009.html}{link} |
allows you to make XML-RPC calls using the Jabber protocol |
{link:Smack|http://www.jivesoftware.org/smack/}{link} |
Jabber library from Jive Software to handle the protocol details.
It's really easy to set up a server which provides a set of remotely callable functions.
import groovy.net.xmlrpc.*
import org.jivesoftware.smack.XMPPConnection
def server = new JabberRPCServer()
|
sever.echo = {return it} // the closure is now named "echo" and is remotely callable
|
def serverConnection = new XMPPConnection("talk.example.org", 5222, "example.org")
serverConnection.login("myServerId", "myServerPassword") // logging in as myServerId@example.org
server.startServer(serverConnection)
|
It's pretty easy to make the remote calls too
def clientConnection = new XMPPConnection("talk.example.org", 5222, "example.org")
clientConnection.login("myClientId", "myClientPassword") // logging in as myClientId@example.orgm
def serverProxy = new JabberRPCServerProxy(clientConnection, "myServerId")
|
println severProxy.echo("Hello World!")
|