Federating Your Wave Server

*** Edit the information contained here is out of date. To find more up to date information please visit here: http://wavingtheshiny.collaborynth.com.au/books/fedone-book/fedone-book ***

Now that you've setup your Wave Reference Server, you're probably going to want to test out one of THE big features. Federation. This post will take you through setting it up.

What Is Federation?

Federation is the thing that moves Wave out from JAGB (Just Another Google Beta) to being something more. It is the server to server communication protocol. This is what allows you to run your own Wave server and communicate with any other Wave server.

Okay, Cool, So How Do I Set It Up?

We actually did most of the work for setting up Federation in the last tutorial. To finish the job we simply need to do the following:

Ports: If you're running the server behind a firewall or NAT, then you'll need to setup port forwarding for port 5269 on your device to your Server.

DNS: For the moment there isn't an "Official" port for the Wave Federation Protocol. This means that the WRS relies on SRV records to indicate which port it should be communicating with the remote server on. Below is an example of an SRV record for your Wave Server.

_xmpp-server._tcp.blah.com. 3600 IN SRV 10 0 5269 wave.blah.com.

Also if this is a new subdomain for your domain don't forget to add an A record.

wave.blah.com  IN A [IPADDRESS]

Note: If you're using a subdomain to house your WRS (say wave.blah.com) you will need to setup a second A record. Openfire lists each component as a subdomain of the nominated domain. So in the case of wave.blah.com you would also need to setup a wave.wave.blah.com A record.

How Do I Test It?

Testing the Federation is pretty simple. In the run-server.sh scrip there is an entry xmpp_server_ping. If you put the url of a known working Wave Server here it will send out a packet on startup and if all is working well, you should recieve a reply from the server.

Blog Catagories: 

Comments

 Hi James - great post - thanks.

I had a query on the port number you used in your DNS SRV record. Isn't in the XMPP S2S port that is needed to be defined, that is: 5269? The 5275 port is simply the local port that your Openfire server will listen on for the component connection from the Wave Reference Server? (And therefore, you need to open up 5269 on your NAT device?)

Or have I got it completely mixed up?

Thanks again,

Damian.

The correct port number is 5269, 5275 is the result of a mixup on my end. I'll make the change :)

.. this was something to test while waiting more tips for Web UI integrationd etails from Wave team. Thanks for documenting this. Maybe you could see something obvious in following or have you seen similar problems while testing federation between two wave servers.

I did the two indetical setup to different domains:
 - host A: wave.subA.domain.com
 - host B: wave.subB.domain.com

Waves in the both installations are working internally. I had to add A record for same IP (or /etc/hosts entry) for the both subA.domain.com and subB.domain.com. Otherwise server did not started properly with following error:

INFO: Starting client frontend on host: x.x.x.x port: 9876
couldn't connect to XMPP server:org.xmpp.component.ComponentException: java.net.UnknownHostException: subA.domain.com
Aug 2, 2009 10:32:53 PM org.waveprotocol.wave.examples.fedone.ServerMain run

I also added SRV record as you instructed below. I defined xmpp_server_ping for run-server.sh scripts for both server (A for B, B for A)..

Both installation started properly when /etc/hosts entry added.  I started the server A first. The following log entry seen in server A after server B started:

INFO: Starting server
Aug 2, 2009 10:39:33 PM org.waveprotocol.wave.examples.fedone.federation.xmpp.WaveXmppComponent processPacket
INFO: received XMPP packet:
<iq type="get" id="7884-0" to="wave.subA.domain.com" from="wave.subB.domain.com">
  <query xmlns="http://jabber.org/protocol/disco#items"/>
</iq>
Aug 2, 2009 10:39:33 PM org.waveprotocol.wave.examples.fedone.federation.xmpp.WaveXmppComponent sendPacket
INFO: sent XMPP packet:
<iq type="result" id="7884-0" from="wave.subA.domain.com" to="wave.subB.domain.com">
  <query xmlns="http://jabber.org/protocol/disco#info"/>
</iq>

Then I tried to collaborate between A and B. It looks like all request from A are going to B and seen in B's log, but what ever B's is trying to send nothing seen in A. I noticed following:

in server A: /add user2@subB.domain.com
 - number of log lines in both server A and B, but nothing happen. The last entry in log B:

INFO: received XMPP packet:

<iq type="result" id="5000-2" from="dev2.ihalainen.fi" to="wave.subB.domain.com">
  <query xmlns="http://jabber.org/protocol/disco#items">
    <item jid="pubsub.subA.domain.com" name="Publish-Subscribe service"/>
    <item jid="wave.subA.domain.com" name="Google Prototype Wave Server - FedOne"/>
    <item jid="conference.subA.domain.com" name="Public Chatrooms"/>
  </query>
</iq>
Aug 2, 2009 10:45:07 PM org.waveprotocol.wave.examples.fedone.federation.xmpp.WaveXmppComponent sendPacket
INFO: sent XMPP packet:
<iq type="get" id="7873-3" to="pubsub.subA.domain.com" from="wave.subB.domain.com">
  <query xmlns="http://jabber.org/protocol/disco#info"/>
</iq>

Note: Why it is using pubsub host here?

in server B: /add user@subA.domain.com

Nothing seen in server A log. Two last entries in server B log:

Note! why it is trying to connect with the domain name and not with the server host name?

Aug 2, 2009 10:49:47 PM org.waveprotocol.wave.examples.fedone.federation.xmpp.XmppDisco sendDiscoItemsGet
INFO: Trying to discover remote server: subA.domain.com
Aug 2, 2009 10:49:47 PM org.waveprotocol.wave.examples.fedone.federation.xmpp.WaveXmppComponent sendPacket
INFO: sent XMPP packet:
<iq type="get" id="1480-4" to="subA.domain.com" from="wave.subB.domain.com">
  <query xmlns="http://jabber.org/protocol/disco#items"/>
</iq>
Aug 2, 2009 10:49:48 PM org.waveprotocol.wave.examples.fedone.federation.xmpp.WaveXmppComponent processPacket
INFO: received XMPP packet:

<iq type="result" id="1480-4" from="subA.domain.com" to="wave.subB.domain.com">
  <query xmlns="http://jabber.org/protocol/disco#items">
    <item jid="pubsub.subA.domain.com" name="Publish-Subscribe service"/>
    <item jid="wave.subA.domain.com" name="Google Prototype Wave Server - FedOne"/>
    <item jid="conference.subAdomain.com" name="Public Chatrooms"/>
  </query>
</iq>
Aug 2, 2009 10:49:48 PM org.waveprotocol.wave.examples.fedone.federation.xmpp.WaveXmppComponent sendPacket
INFO: sent XMPP packet:
<iq type="get" id="7287-5" to="subA.domain.com" from="wave.subB.domain.com">
  <query xmlns="http://jabber.org/protocol/disco#info"/>
</iq>

Openfire by default supports the pubsub service and conference service. When the Wave server makes a request to the remote server the first thing it does is try and find the wave service being offered, however it cheats a little by assuming that the wave service will be the first one offered by the remote XMPP server. If this doesn't happen the local server sends anyway, unless there is absolutely no service being offered.

The key is to disable the pubsub and conference service in Openfire. I've updated the How To to reflect this but here are the instructions:

Disablilng Pubsub:

To disable the Pubsub service do the following:

Browse to Server Manager->System Properties. Scroll down to the bottom and enter the following information:

Property Name: xmpp.pubsub.enabled

Property Value: false

Disabling Group Chat:

Browse to Group Chat->Group Chat Settings.

Delete the conference domain.

Once you have completed these steps I find it best to restart the Openfire service (sudo /etc/init.d/openfire restart under ubuntu).

Thanks. It was an Openfire issue.

When setting up a wave on a subdomain (wave.domain.com), your records indicate to configure wave.wave in the A records and the SRV records.When I do this, I receive a 404 Jabber error code indicating "remote-server-not-found". What do I additionally need to configure? Logs are as follows.

2009.10.14 17:59:34 ServerDialback: OS - Trying to connect to acmewave.com:5269(DNS lookup: primary.acmewave.com:5269)
2009.10.14 17:59:34 ServerDialback: OS - Connection to acmewave.com:5269 successful
2009.10.14 17:59:34 ServerDialback: OS - Sent dialback key to host: acmewave.com id: f9509b02 from domain: wave.wave.domain.com
2009.10.14 17:59:34 ServerDialback: OS - Unexpected answer in validation from: acmewave.com id: f9509b02 for domain: wave.wave.domain.com answer:<stream:error xmlns:stream="http://etherx.jabber.org/streams"><remote-connection-failed xmlns="urn:ietf:params:xml:ns:xmpp-streams"/></stream:error>
2009.10.14 17:59:34 OutgoingSessionPromise: Error sending packet to remote server:
<iq type="get" id="2841-2" to="acmewave.com" from="wave.wave.domain.com">
<query xmlns="http://jabber.org/protocol/disco#items"/>
</iq>
java.lang.Exception: Failed to create connection to remote server
at org.jivesoftware.openfire.server.OutgoingSessionPromise$PacketsProcessor.sendPacket(OutgoingSessionPromise.java:252)
at org.jivesoftware.openfire.server.OutgoingSessionPromise$PacketsProcessor.run(OutgoingSessionPromise.java:216)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
2009.10.14 18:00:08 DefaultAdminProvider: Convert XML to provider.
2009.10.14 18:00:08 JettyLog: Ignoring extra content

Hi there,
I got it running on gentoo. You have to edit /etc/conf.d/openfire and select the SDK 1.6.

After you create an admin user, make sure you restart the server or you won't be able to login.

Is the client front end working?

Jul 22, 2009 2:21:02 PM org.waveprotocol.wave.examples.fedone.rpc.ServerRpcProvider?$Connection INFO: Expecting: waveserver.ProtocolWaveClientRpc?.Open

Exception in thread "pool-1-thread-4" java.lang.IllegalStateException?: Payload (2003896845 bytes) too large for buffer (32768 bytes)
Thanks
MichaeL
testking ccna Trainer

They should also do their part. Especially in troubleshooting. - GE Pro Elite