From beecb8a67537a29270df4257477155b5ad731d21 Mon Sep 17 00:00:00 2001
From: Florian Schmaus
The org.jivesoftware.smack.XMPPConnection class manages your connection to an XMPP
- server. The default implementation is the org.jivesoftware.smack.XMPPConnection
- class. Two constructors are mainly used. The first, XMPPConnection(String) takes
+ server. A default implementation is the org.jivesoftware.smack.XMPPTCPConnection
+ class. Two constructors are mainly used. The first, XMPPTCPConnection(String) takes
the server name you'd like to connect to as an argument. All default connection settings will
be used:
@@ -33,7 +33,7 @@
- Alternatively, you can use the XMPPServer(ConnectionConfiguration) constructor to
+ Alternatively, you can use the XMPPTCPConnection(ConnectionConfiguration) constructor to
specify advanced connection settings. Some of these settings include:
@@ -61,9 +61,8 @@
// Create the configuration for this new connection
ConnectionConfiguration config = new ConnectionConfiguration("jabber.org", 5222);
config.setCompressionEnabled(true);
-config.setSASLAuthenticationEnabled(true);
-Connection connection = new XMPPConnection(config);
+AbstractXMPPConnection connection = new XMPPTCPConnection(config);
// Connect to the server
connection.connect();
// Log into the server
@@ -80,7 +79,7 @@ manager will try to immediately reconnect to the server and increase the delay b
successive reconnections keep failing.
In case you want to force a reconnection while the reconnetion manager is waiting for the next
-reconnection, you can just use XMPPConnection#connect() and a new attempt will be made.
+reconnection, you can just use AbstractXMPPConnection#connect() and a new attempt will be made.
If the manual attempt also failed then the reconnection manager will still continue the
reconnection job.
- XMPPConnection.DEBUG_ENABLED = true;
+ SmackConfiguration.DEBUG_ENABLED = true;
@@ -39,7 +39,7 @@ add the following line to your application before opening new connections:
-XMPPConnection.DEBUG_ENABLED = false; +SmackConfiguration.DEBUG_ENABLED = false;
diff --git a/documentation/extensions/messageevents.html b/documentation/extensions/messageevents.html index d91492b3f..fd64fc2fe 100644 --- a/documentation/extensions/messageevents.html +++ b/documentation/extensions/messageevents.html @@ -99,9 +99,9 @@ for notifications and will send the message to the other user. The other user wi to a MessageEventManager that will listen and react to the event notification requested by the other user.
// Connect to the server and log in the users - conn1 = new XMPPConnection(host); + conn1 = new XMPPTCPConnection(host); conn1.login(server_user1, pass1); - conn2 = new XMPPConnection(host); + conn2 = new XMPPTCPConnection(host); conn2.login(server_user2, pass2); // User2 creates a MessageEventManager @@ -195,7 +195,7 @@ to a MessageEventManager that will listen and react to the event notifica the requests for notifications and sends the message.// Connect to the server and log in - conn1 = new XMPPConnection(host); + conn1 = new XMPPTCPConnection(host); conn1.login(server_user1, pass1); // Create a MessageEventManager @@ -241,4 +241,4 @@ the requests for notifications and sends the message.