powered by Jive Software

As3

Hi Nick,

I was able to fix the problem. But I only if the swf is rendered from my machine.

When i try rendering the swf from a remote machine in an html (flex program) it doesnt seem to connect to the server and gives me an auth error.

Would you be willing to share your flex code from your blog so that I could see how the connection happens.

Regards,

Do you have a crossdomain.xml available on the server and loaded by your Flex GUI?

An auth error usually indicates that the username and password were not set in the XMPPConnection instance before calling the connect method, or the credentials were not valid. Try setting the username to “test”, and the password to “test” as well.

I will be sharing the demo gui source but not quite yet. I think it would be more confusing than helpful at this point as it currently tests features not released yet like using a binary socket connection rather than the xml socket.

Rest assured, Sean and I are working on this and will be releasing documented code shortly… and a tutorial to accompany the GUI.

yes. I have a crossdomain.xml file that the server loads. Also I am really looking forward to the documentation.

I still dont know why it doesnt connect to my wiildfire server when the swf is rendered in an html, but when run locally it seems to connect.

Regards

Schandra, try with the following crossdomain.xml and AS 3 setting:

crossdomain.xml (present in the document root from the webserver you’'re running the flash from):

<?xml versin="1.0"?>

(for some reason this editor doesn’'t like the asterisk sign, so replace the with one )

AS3: (load during movie initialization, before you connect to the XML Socket)

Security.loadPolicyFile(“http://webserver/crossdomain.xml”);

This works fine for me. Good to see xiff is ported to AS3. A little late for me as I’‘ve did some of my own porting for a Flex2 chat client. One remark though, don’'t forget that using XMLSocket will not allow you to connect through proxies with DA disabled on a network.

Edit: did you also check for FW and port issues? You might want to change the port and try again.

B.

Thanks for the post !

I kinda figured out the problem. the crossdomain.xml file has to be on the same server from which the swf is being rendered. I had it on a different server and so it was not able to load it.

Hi Nick,

I am trying to register people on the fly, but for somereason when I

conn.addEventListener(RegistrationFieldsEvent.REGFIELDS, onRegister);

doesnt seem to reach the function onRegister, as if the event was not thrown. But I do see the corresponding incoming/outgoing requests.

Please help.

registration fields is a query to the server to see what fields are necessary to register. i assume you are not trying to get these but trying to simply register the user.

if you are indeed trying to get the reqired fields from the server that is a different process…

conn.addEventListener(RegistrationSuccessEvent.REGISTRATIONSUCCESS, onRegistrationSuccess);

internal function onRegistrationSuccess() : void

{

_conn.username = loginJID.text;

_currentUserJID = loginJID.text;

_conn.password = loginPassword.text;

_conn.server = _serverLocation;

_conn.connect(“standard”);

}

if you could be more specific as to exactly what you are trying to do i’'ll try to help out…

//nick

Hi Nick,

I am trying to register a user on the fly. I have the username, password, email, name of the user that I am trying to register.

The following is the code.

conn.addEventListener(RegistrationFieldsEvent.REGFIELDS, onRegister);

conn.addEventListener(RegistrationSuccessEvent.REGISTRATIONSUCCESS, registerComplete);

internal function registerComplete(e:RegistrationSuccessEvent) : void

{

Alert.show(“User Registered”);

}

internal function onRegister(e:RegistrationFieldsEvent): void

{

// We shall create the user here.

Alert.show(“Got Registration fields”);

var fieldMap:Array = new Array();

fieldMap[0] = “username:” + username;

fieldMap[1] = “name:” + name;

fieldMap[2] = “email:” + email;

fieldMap[3] = “password:” + password;

_conn.sendRegistrationFields(fieldMap, null);

}

It doesnt seem to come back to the registerComplete function. Am I creating the fieldMap correctly to be sent for registration ?

Also shouldnt there be a (e:<SOMEEVENT) as the arguments to the function in the code that you showed ?

Hi,

I fixed the problem …

/*for( var i:String in fieldMap ) {

Alert.show(i + " " + fieldMap[i]);

ext[i] = fieldMap[i];

}*/

ext.username = fieldMap[“username”];

ext.name = fieldMap[“name”];

ext.email = fieldMap[“email”];

ext.password = fieldMap[“password”];

I changed the commented code to the uncommented code in the XMPPConnection.as to fix the registration part.

Hi,

I was trying to add users on the fly using the addContact function in the roster. But I am not able to get back any event even when the person that I am adding already has an account on the server.

public function addContact( id:String, displayName:String, group:String, requestSubscription:Boolean=true ):void

{

if( displayName == null )

displayName = id;

var callbackObj:Roster = null;

var callbackMethod:String = null;

var subscription:String = RosterExtension.SUBSCRIBE_TYPE_NONE;

if( requestSubscription == true ) {

callbackObj = this;

callbackMethod = “addContact_result”;

pendingSubscriptionRequestJID = id;

subscription = RosterExtension.SUBSCRIBE_TYPE_TO;

}

var tempIQ:IQ = new IQ (null, IQ.SET_TYPE, XMPPStanza.generateID(“add_user_”), callbackMethod, callbackObj);

var ext:RosterExtension = new RosterExtension( tempIQ.getNode() );

ext.addItem( id, null, displayName, );

tempIQ.addExtension( ext );

myConnection.send( tempIQ );

addRosterItem( id, displayName, RosterExtension.SHOW_UNAVAILABLE, “Pending”, group, subscription );

}

doesnt seem to return back to

addContact_result.

I am not sure why

Hi Nick,

I was wondering if you would want to put this functionality in Xiff, which gives you back in an event of whether the user exists in the system or not. Or does functionality already exist in Xiff ?

Regards,

Srini

Hi nick,

is the AS3 branche in the svn repository the right one?

Hi Nick,

Have you released the Xiff library for AS 3 ?

No it has not been officially released…

Things have been super busy…

You can get the current build here…

I hesitate to release because the documentation has not been updated properly.

http://svn.jivesoftware.org/svn/repos/xiff/branches/xiff_as3_flexlib_beta1

This is a flex library project… Just add the swc to your classpath…

This code is not thoroughly tested and will likely change quite a bit… use at your own risk…

//nick

  1. Nick, are you going to fully type your objects ?

  2. will XIFF support vCards?

  3. will it support IM gateways?

ok too much questions…

  1. all the objects are strongly typed (Presence, Roster etc…)

  2. not sure about vCards

  3. if you mean support for other protocols (aim) the probably not… this is centered around xmpp… i believe there are server side solutions for this.

Hi Nick,

Thanks for giving us the link. The previous release (alpha) worked pretty well for what I wanted to do… I will test this one too.

Srini

Nick, buddies in the roster are object type … this isn’'t fully typed.

when I asked for client-side to support the server-side solution. WildFire now supports IM gateways and I wonder if it was possible to XIFF to support that.

vCard support could be great!