Created
June 1, 2015 22:14
-
-
Save fpopic/291fc9f69d33a1940810 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void connect() throws IOException, XMPPException, SmackException { | |
| xmpptcpConnection = new XMPPTCPConnection(XMPPTCPConnectionConfiguration.builder() | |
| .setSecurityMode(disabled) | |
| .setResource(resource) | |
| .setHost(localhost) | |
| .setServiceName(serviceName) | |
| .setPort(port) | |
| .setSendPresence(true) | |
| .setDebuggerEnabled(true) | |
| .build() | |
| ); | |
| // Unutar n miliseknudi provjeri je li dosla poruka o primitku | |
| xmpptcpConnection.setPacketReplyTimeout(10000); | |
| // Prepare listeners before inital connecting. | |
| xmpptcpConnection.addConnectionListener(this); | |
| // Povezi se | |
| xmpptcpConnection.connect(); | |
| // Provjerava dostupnost Openfire servera svakih 10*60s = 10min. | |
| PingManager.setDefaultPingInterval(600); | |
| PingManager.getInstanceFor(xmpptcpConnection).registerPingFailedListener(this); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment