Commit 403e3a75 authored by Tom Evans's avatar Tom Evans

Cleanup websocket plugin

Update dependencies and documentation to prep for pending Openfire 4.0
release.
parent 7768e4fb
......@@ -896,7 +896,7 @@ public class LocalClientSession extends LocalSession implements ClientSession {
sb.append("<session xmlns=\"urn:ietf:params:xml:ns:xmpp-session\"><optional/></session>");
// Offer XEP-0198 stream management capabilities if enabled.
if(JiveGlobals.getBooleanProperty("stream.management.active", true)) {
if(JiveGlobals.getBooleanProperty(StreamManager.SM_ACTIVE, true)) {
sb.append(String.format("<sm xmlns='%s'/>", StreamManager.NAMESPACE_V2));
sb.append(String.format("<sm xmlns='%s'/>", StreamManager.NAMESPACE_V3));
}
......
......@@ -35,6 +35,8 @@ public class StreamManager {
packet = p;
}
}
public static final String SM_ACTIVE = "stream.management.active";
/**
* Stanza namespaces
......
......@@ -44,6 +44,12 @@
Openfire WebSocket Plugin Changelog
</h1>
<p><b>1.1.3</b> -- January 6, 2016</p>
<ul>
<li>Update dependencies and documentation for pending Openfire 4.0 release.</li>
</ul>
<p><b>1.1.2</b> -- December 17, 2015</p>
<ul>
......
......@@ -8,8 +8,8 @@
<name>Openfire WebSocket</name>
<description>Provides WebSocket support for Openfire.</description>
<author>Tom Evans</author>
<version>1.1.2</version>
<date>12/17/2015</date>
<version>1.1.3</version>
<date>01/06/2016</date>
<url>https://tools.ietf.org/html/rfc7395</url>
<minServerVersion>3.11.0</minServerVersion>
<minServerVersion>4.0.0 Alpha</minServerVersion>
</plugin>
\ No newline at end of file
......@@ -71,5 +71,34 @@ connector. To establish a secure WebSocket, modify the following URL as appropri
wss://your.openfire.host:7443/ws/
</pre>
<h2>Configuration</h2>
<p>
The WebSocket plugin implements the Stream Management (<a href="http://xmpp.org/extensions/xep-0198.html">XEP-0198</a>)
"ack" capabilities introduced with Openfire 4.0. This provides assurance for XMPP packet delivery by allowing the peers
to agree on the number of stanzas exchanged. Two system properties are available to configure this feature:
</p>
<dl>
<dt><pre>stream.management.active</pre></dt>
<dd>Boolean property to enable/disable stream management (default: true)</dd>
<dt><pre>stream.management.unsolicitedAckFrequency</pre></dt>
<dd>Integer property indicating frequency of unsolicited ack's from the server to the client (default: 0)</dd>
</dl>
<p>
XEP-0198 allows either party (client or server) to send unsolicited ack/answer
stanzas on a periodic basis. This implementation approximates BOSH ack behavior
by sending unsolicited <a /> stanzas from the server to the client after a
configurable number of stanzas have been received from the client.
</p>
<p>
Setting the system property to "1" would indicate that each client packet should
be ack'd by the server when stream management is enabled for a particular stream.
To disable unsolicited server acks, use the default value for system property
"stream.management.unsolicitedAckFrequency" ("0"). This setting does not affect
server responses to explicit ack requests from the client.
</p>
</body>
</html>
......@@ -15,8 +15,6 @@
*/
package org.jivesoftware.openfire.websocket;
import java.io.UnsupportedEncodingException;
import org.dom4j.Element;
import org.jivesoftware.openfire.SessionPacketRouter;
import org.jivesoftware.openfire.multiplex.UnknownStanzaException;
......
......@@ -19,13 +19,10 @@ import java.net.InetSocketAddress;
import org.dom4j.Namespace;
import org.jivesoftware.openfire.PacketDeliverer;
import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.openfire.auth.UnauthorizedException;
import org.jivesoftware.openfire.net.VirtualConnection;
import org.jivesoftware.openfire.nio.OfflinePacketDeliverer;
import org.jivesoftware.openfire.spi.ConnectionConfiguration;
import org.jivesoftware.openfire.spi.ConnectionManagerImpl;
import org.jivesoftware.openfire.spi.ConnectionType;
import org.xmpp.packet.Packet;
import org.xmpp.packet.StreamError;
......@@ -35,7 +32,6 @@ import org.xmpp.packet.StreamError;
*/
public class WebSocketConnection extends VirtualConnection
{
private static final String CLIENT_NAMESPACE = "jabber:client";
private InetSocketAddress remotePeer;
private XmppWebSocket socket;
private PacketDeliverer backupDeliverer;
......
......@@ -41,6 +41,7 @@ import org.jivesoftware.openfire.net.SASLAuthentication;
import org.jivesoftware.openfire.net.SASLAuthentication.Status;
import org.jivesoftware.openfire.session.ConnectionSettings;
import org.jivesoftware.openfire.session.LocalClientSession;
import org.jivesoftware.openfire.streammanagement.StreamManager;
import org.jivesoftware.util.JiveConstants;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.TaskEngine;
......@@ -304,7 +305,7 @@ public class XmppWebSocket {
sb.append(String.format("<session xmlns='%s'><optional/></session>", "urn:ietf:params:xml:ns:xmpp-session"));
if (isStreamManagementAvailable()) {
sb.append(String.format("<sm xmlns='%s'/>", "urn:xmpp:sm:3"));
sb.append(String.format("<sm xmlns='%s'/>", StreamManager.NAMESPACE_V3));
}
}
......@@ -365,13 +366,7 @@ public class XmppWebSocket {
}
private boolean isStreamManagementAvailable() {
try {
// use reflection to determine whether stream management is supported
Class.forName("org.jivesoftware.openfire.streammanagement.StreamManager");
return JiveGlobals.getBooleanProperty("stream.management.active", true);
} catch (ClassNotFoundException cnfe) {
return false;
}
return JiveGlobals.getBooleanProperty(StreamManager.SM_ACTIVE, true);
}
//-- Keep-alive ping for idle peers
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment