eJabberd - Login Problem

Hi all,
I am new to eJabberd server.
I have created a simple connection Code. And Compiled My Flash File(No Error).
My Flash File is getting connected with eJabberd, But Immediately After connection it get Disconnected. I don't Know What is the Reason. It didn't Show Any Error.

Can any one Help me to overcome this problem. Or let me know where can i check Why this get disconnected. Below is the Code i have used.

Following is the Code i have used. Pls help me.
/************************************************************************/
import org.jivesoftware.xiff.im.Roster;
import org.jivesoftware.xiff.core.XMPPConnection;
import org.jivesoftware.xiff.data.XMPPStanza;
import org.jivesoftware.xiff.data.Message;
import org.jivesoftware.xiff.data.IQ;
import org.jivesoftware.xiff.data.register.RegisterExtension;
import org.jivesoftware.xiff.data.PrivateDataManager;
import org.jivesoftware.xiff.data.PrivateDataExtension;
import org.jivesoftware.xiff.conference.Room;
import org.jivesoftware.xiff.conference.InviteListener;
//
var connection = new XMPPConnection();
connection.ignoreWhite = true;
connection.username = "deva";
connection.password = "password";
connection.server = "aiche018";
connection.port = "5222";
//
connection.resource = "XIFFIAN";
//
var globalHandler = new Object();
globalHandler.handleEvent = function(eventObj) {
trace("GLOBAL: "+eventObj.type);
switch (eventObj.type) {
case "login" :
trace("LOGIN");
break;
case "connection" :
trace("Connection Established");
connectToChat();
break;
case "disconnection" :
trace("You are Disconnected");
break;
case "message" :
trace("Message Recieved : "+msg.body);
break;
case "error" :
trace("Error");
break;
}
};
//
connection.addEventListener("login", globalHandler);
connection.addEventListener("message", globalHandler);
connection.addEventListener("connection", globalHandler);
connection.addEventListener("disconnection", globalHandler);
connection.addEventListener("error", globalHandler);
//
var chatRoom = new Room(_root.connection);
function connectToChat() {
chatRoom.roomName = "myRoom";
chatRoom.nickname = "deva";
chatRoom.password = "password";
chatRoom.conferenceServer = "conference.aiche018";
chatRoom.join();
}
//
send_btn.onPress = function() {
chatRoom.sendMessage(messageBody);
};
//
connection.connect();
/************************************************************************/

Bug in Adobe Flash

Unfortunately, Adobe Flash do not allow XMPP compliant communication. Because ejabberd do not want the XMPP protocol become a mess like in the web browser world (where browser builders support many unstandard behaviour in web pages which makes the web less open for entrants e.g.), ejabberd do not accept by default this unstandard behaviour of Flash (and so do most self-respecting Jabber servers including jabberd14, jabberd2 and probably others). There is a patch to fix the unstandard behaviour in Adobe Flash though.

I would strongly encourage you to send a complaint about the bad behaviour of Flash to Adobe; the more they receive of these, the higher the chance the bug will be fixed in a future version.

--
sander

eJabberd-Login Problem

Thank you sander,

I am Using eJabberd1.2.
Windows XP os
Flash 8 Professional for development of Client Connection.

The url provided by you is having Data for Non-Windows OS. So can u pls help me to Fix this. Actually i m using eJabberd Windows Version Installer, I am not compiling the source to create the Server. If i have to compile it Thorugh which i can Compile?

Pls Help me...
Thank you verymuch For your interest to Help.

To The World You are SomeOne
To SomeOne You are The World

Good news, it seems the

Good news, it seems the information is outdated. Flash 9 supports all XMPP servers. So you do not need the patch anymore. Just make sure you use the development version of XIFF; according to the Jive people that should work.

--
sander

??? I don't think so!

??? I don't think so! Flash 9 still requires an end-byte when using the higher level socket connector which is just what is used in the latest version of Jive's XIFF 3 in subversion. WE NEED A WINDOWS RELEASE WITH SUPPORT FOR FLASH! HELP WE WHO ARE ERLANG CHALLENGED! Purty please! ;-)

Thank you.

P.S.
I don't mean to sound frustrated... My next step is to do the compilation as best I can myself. If I get anything, I'll post it up.

How to: XIFF 3.0.0 & ejabberd

Alrighty... So, the higher-level socket connector does require an end-byte. However, XIFF 3.0.0 contains a XMPPSocketConnection class that works with the new lower-level socket connector in Flash9. The gent before me had it correct, but didn't hit the details.

There is a solution in this thread that only requires a simple change in code to make XIFF 3.0.0 play nice with ejabberd. I've outlined the steps below:

Get XIFF 3.0.0 from jivesoftware's SVN (subversion) server. There are numerous links burried in igniterealtime.org that will lead you to the repository. In the XMPPSocketConnection.as file under the "core" directory, change line 108 to the following:

openingStreamTag = "<?xml version=\"1.0\"?>
  <stream:stream to=\"" + server + "\" xmlns=\"jabber:client\" 
  xmlns:stream=\"http://etherx.jabber.org/streams\">";

Just copy and paste it in. The difference is that the version="1.0" attribute and value are taken off the end of the tag. After this, in your ActionScript, connect using the core.XMPPSocketConnection class instead of the XMPPConnection class and pass the XMPPSocketConnection.connect() method a String "standard" which will tell XMPPSocketConnection to send the string you just modified in the code. Here's an example of making a connection:

import org.jivesoftware.xiff.core.XMPPSocketConnection;
var connection = new XMPPSocketConnection();
//properties are constructed here...
//then connection is made:
connection.connect("standard");

-Aaron

OOPS!

This forum doesn't stop html from posts, so the openingStreamTag that was supposed to appear in my last post, didn't. However, just remove the version="1.0" attribute from the end of the tag on line 108 and you'll be fine.

-Aaron

Comment fixed

No problem, I've slightly modified the HTML on your comment. If there's still any error on it, tell me.

It depends on Flash version

Are you targeting Flash 9 or Flash 8 ?
Flash 9 supports normal XML stream and it should work as is.
Otherwise, for Flash 8, you need to patch ejabberd to support null characters that Flash insert inside XML stream.

Flash Patch

The Flash patch is a patch because, Adobe has made a very ugly hack in adding null characters in streams. This is not standard and adding this uglyness in ejabberd seems odd.
They fixed the behaviour in Flash 9 fortunatly.
Did you try with Flash 9 ?

Syndicate content