I am trying to connect to my local XMPP server using the XIFF library however I am unable to do so.
I installed eJabberd on my localhost and connected to it with an XMPP client (Pandion) and this is working fine... I am able to connect to the local jabber server.
Next, I tried connecting to the XMPP server using the following code:
LoginView.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" title="Login">
<s:layout>
<s:FormLayout/>
</s:layout>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script source="connection/Connection.as"/>
<s:Spacer/>
<s:Label text="Username"/>
<s:TextInput id="txtUsername" width="200"/>
<s:Spacer/>
<s:Label text="Password"/>
<s:TextInput id="txtPassword" width="200" displayAsPassword="true"/>
<s:Button id="btnLogin" label="Login" click="login(txtUsername.text, txtPassword.text)" mouseUp="navigator.pushView(HomeView)"/>
</s:View>
Connection.as:
import org.igniterealtime.xiff.conference.Room;
import org.igniterealtime.xiff.core.UnescapedJID;
import org.igniterealtime.xiff.core.XMPPConnection;
import org.igniterealtime.xiff.events.LoginEvent;
private var con:XMPPConnection;
private var room:Room;
private function login (username:String, password:String): void {
con = new XMPPConnection ();
con.username = username + "@mydomain";
con.password = password;
con.server = "localhost";
con.port = 5222;
con.connect (0);
}
However I am unable to connect to connect to the XMPP server using the ActionScript code above. Just wondering where I may be going wrong.
Any help would be appreciated.
Thanks!