Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
bartbert #1
Member since Sep 2005 · 22 posts
Group memberships: Members
Show profile · Link to this post
Subject: XmppComponentConnection
Has anyone used the XmppComponentConnection class to connect to a Wildfire server? Any example code on how to connect, send, receive etc. would be most appreciated. Also, any tips on how to configure the component in Wildfire would be helpful as well.
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello,

in the samples directory there should be a small component sample.

In your Wildfire Server you have to go to "External Components" under Server Settings. Here you must enable the component support and can choose the port and a secret for your components. You will have the same secret for all components then.
Alternative you can specify the subdomain of your component and the secret for each component yourself. Then the server accepts only component connections to the allowed subdomains with the given secret. Every component could have it own secret then.

A component needs a subdomain. So for example id your server domain is myserver.com and you want to write a component which gives you a weather forecast you can run it on weather.myserver.com


Alex
Avatar
bartbert #3
Member since Sep 2005 · 22 posts
Group memberships: Members
Show profile · Link to this post
Hi Alex,

I tried something similar to your example code (shown below), but it seems like I'm not getting a connection. When I try a SocketConnectionType = Direct, it just hangs and doesn't output anything. When I try a SocketConnectionType = HttpPolling, I see the following output:

"<stream:stream to='games.dilbert' xmlns='jabber:component:accept' xmlns:stream='http://etherx.jabber.org/streams'>"

But then I get an error in the PollClientSocket class (line 276) because the Address variable in the code below is null:

  1.     HttpWebRequest req  = (HttpWebRequest) WebRequest.Create(Address);


This is basically the code that I'm using in my sample component:
  1.             this.xmppConn = new XmppComponentConnection();
  2.             this.xmppConn.AutoResolveConnectServer = true;
  3.             this.xmppConn.Password = this.txtPassword.Text;
  4.             this.xmppConn.Port = int.Parse(this.txtPort.Text);
  5.             this.xmppConn.Server = "localhost";
  6.             this.xmppConn.SocketConnectionType = agsXMPP.net.SocketConnectionType.HttpPolling;
  7.             this.xmppConn.ComponentJid = new Jid("games.dilbert");
  8.  
  9.             this.xmppConn.OnError += new ErrorHandler(xmppConn_OnError);
  10.             this.xmppConn.OnReadXml += new XmlHandler(xmppConn_OnReadXml);
  11.             this.xmppConn.OnLogin += new ObjectHandler(xmppConn_OnLogin);
  12.             this.xmppConn.OnWriteXml += new XmlHandler(xmppConn_OnWriteXml);
  13.             this.xmppConn.OnClose += new ObjectHandler(xmppConn_OnClose);
  14.  
  15.             this.xmppConn.Open();

Any ideas on how to troubleshoot this to figure out why it is not connecting? I have been able to run the Mini-client sample application and connect with it, so it seems that it is at least possible to connect.
This post was edited on 2006-02-23, 08:16 by Alex.
Avatar
Jabberer #4
Member since Feb 2006 · 249 posts
Group memberships: Members
Show profile · Link to this post
sorry bartbert, there went something wrong with the latest update.
Please try to replace the attached file XmppComponentConnection.cs in agsXMPP and recompile it.
Alex will add it to SVN as soon as possible.
Software Developer
AG-Software
The author has attached one file to this post:
XmppComponentConnection.cs 8.2 kBytes
You have no permission to open this file.
Avatar
freemanm #5
Member since Mar 2006 · 1 post
Group memberships: Members
Show profile · Link to this post
In reply to post #2
Subject: Interacting with server as a component
I have successfully connected with the component connection to the server.
I also receive XML content when I send a message to the component.

These messages I receive in the ReadXml event method.
Now my question is:
How do I send a message back to the server in reply to the message I just receive.
When I try to do this I receive errors from the server to say this is an invalid message.

Is it possible you could provide a sample code for this.

Secondly, when will the OnRoute event method be called ?
Marnus
Avatar
Alex #6
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello,

i don't really understand what you mean. Could you post your debug XML so we could see whats going on. Please post also the XML of the login process you we can see if you connected the component to the server correctly.

Alex
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP RSS