Jive is not automatically terminating the socket connections

Hi,

I have an application that I’'m trying to get to work with the Jive Messenger that utilizes the XIFF library for Flash. most things seem to be working okay except that when a user closes the application without logging out, the Jive server thinks the user is still online.

I also can’'t seem to log back on with the same user because it thinks the user is still online.

Is there a way to make sure that the user’'s presence is sent out as unavailable and the connection is terminated when this occurs?

Thanks for any advice on the matter.

-Chris

Hey Chris,

We are already doing that but it seems that for some reason it’'s not working with flash clients. Can you give me a Flash(XIFF) client so I can reproduce the problem?

Thanks,

– Gato

Hi Gato,

My XMPP Flash client is a little too complicated to be able to just package up and send to you, as it relies on internal webservices and collects patient data here at the hospital where I work.

But with this in mind, it might be possible for me to help you guys put a much simpler implementation together to test and debug this problem.

-Chris

PS Right now I can’'t seem to get the installer for Jive Messenger to run again. I thought that this problem might have had to do with the nightly build I had and wanted to start with a fresh install of a stable copy. Oh well. Let me know if you guys have any information on how to get the installer to run too.

Hey Gato,

I put together a very simple Flash client that will connect to a server that you specify. You can put in any user you want. This should do the job for testing this problem.

Either you refresh the page to sever the connection or load another user. I have only one socket connection going, so the second you log on with another user it kills the original connection.

You can find the example I created here:

http://cnmpro.com/examples/TestJive.zip

Please let me know when you guys fix this problem. It will be essential to getting my application to run on Jive Messenger.

Thanks and have a great weekend.

-Chris

Gato,

I have one point to note on this subject that I discovered today. It looks like if you close the entire browser, not just the window, the Socket gets closed completely and fthe presence of the user does indeed got to unavailable. Closing one browser window/tab will not do the job.

So, this means that Flash does not close the socket if there are other pages still around and that it must send some type of “request” to close the socket but does not do it itself. I guess the trick for you guys then is to find out what this request looks like and respond accordingly. Other XMPP server do respond to the window being closed so there must be a way to do it. Unfortunately, I don’'t know what that is.

I will do some more research tomorrow and let you know if I come up with more information on the subject.

-Chris

Hey Chris,

I’'m using the Flash client that you sent me and tried the following:

. Using FireFox I created a new tab and connected with the server using your HTML. Having many tabs in the browser I closed the tab with the flash client and after a seconds the connection was closed in the server

. Using IE I opened your HTML page and did Ctrl-N to open another window in another URL. I closed the window (with your flash) and after a seconds the connection was closed in the server

Can you tell me how to reproduce the problem?

Thanks,

– Gato

Hi Gato,

I suppose I wasn’‘t waiting long enough for the time out in those situations. I however still do notice a problem if you don’'t actually close the Flash client, but log on with another user. Since I only use one Socket connection the first connection should be severed, but this does not happen.

Now this could be a possible issue with the XIFF library, but I don’'t think so as it only uses one instance of the ListenerXMLSocket per XMPPCOnnection instance.

Let me know if you can reproduce this behavior. Also, is there a way to see if Flash send some type of message when its connection is severed?

Thanks for taking the time to look into this.

-Chris

Hey Chris,

Using your flash client I connected once with a user and then I changed the username and password and connected again. I’‘m now seeing two sessions in the Admin Console. One for each user. I don’'t think there is a problem on the server side. It seems to me that the flash client has generated a new connection while keeping the old connection opened. So ,in your example, you should try closing the old connection before establishing a new one.

Regards,

– Gato

I Gato,

This is the point that I’'m making above.

I never do create a new socket connection. I use the same one. But since I can’'t know what Flash is doing behind the scenes it may indeed be creating a new socket without me knowing it. Either way it is not a huge deal though.

I’'m just wondering now if there is a way to make the Jive Messenger server speed up its response to a dropped connection?

The amount of time that it takes to realize that it is dropped may be problematic for my application.

Any suggestions on this front?

Thanks,

Chris

Here is the code that I am using for the example you are trying. You can see here that the XMPPConnection class never gets instatiated again when logging on with another user.

import mx.controls.Button;

import mx.controls.TextArea;

import mx.controls.TextInput;

import mx.utils.Delegate;

import org.jivesoftware.xiff.core.XMPPConnection;

class TestJive {

//mx components

private var connectButton:Button;

private var outputTextArea:TextArea;

private var serverField:TextField;

private var userField:TextField;

private var passwordField:TextField;

//XMPPConnection

private var socket:XMPPConnection;

/**

  • Starts the application.

*/

public function main():Void {

initComponents();

initSocketServer();

}

private function initComponents() {

connectButton = _root.connectButton;

outputTextArea = _root.xmppOutput;

serverField = root.serverinput;

userField = root.userinput;

passwordField = root.passwordinput;

connectButton.addEventListener(“click”, Delegate.create(this, connectButtonClicked));

}

private function connectButtonClicked():Void {

var server:String = serverField.text;

var user:String = userField.text;

var password:String = passwordField.text;

output("connecting to the server: " + server + “.”);

output("with user: " + user);

output("password: " + password);

socket.server = server;

socket.username = user;

socket.password = password;

socket.connect(“flash”);

}

private function initSocketServer():Void {

socket = new XMPPConnection();

socket.addEventListener(“outgoingData”, Delegate.create(this, handleOutgoingData));

socket.addEventListener(“incomingData”, Delegate.create(this, handleIncomingData));

socket.addEventListener(“login”, Delegate.create(this, loginSuccess));

}

private function handleOutgoingData(eventObj:Object):Void {

output("sent: " + eventObj.data);

}

private function handleIncomingData(eventObj:Object):Void {

output("recv: " + eventObj.data);

}

private function loginSuccess():Void {

output(“Logged In!”);

}

private function output(text:Object):Void {

outputTextArea.text += text + “\n”;

outputTextArea.vPosition = outputTextArea.maxVPosition;

trace(text);

}

}