Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
sasachess #1
Member since Dec 2005 · 7 posts
Group memberships: Members
Show profile · Link to this post
Subject: Web presence and Google Talk
Hi,

I need to develop a presence solution for my web application (ASP.NET and C#) for Google Talk accounts. I want display on a web page user status (online, offline, etc.) with an icon and on click start chat with Google Talk.
It's possible to realize it with agsXMPP library? What I have to know? I'm beginner with jabber/XMPP, help me please!  Thanks. :wink:
Avatar
Alex #2
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
hi sasachess,

this is no problem with agsXMPP.
You need one account (bot) at google. All users that want to use the web presence have to subscribe to this bot (add it to the roster). This bot gets all the presences and could store it in the memory or a database.
The only problem could be the google server. No idea how many presences/users your bot should handle. And how many contacts google will allow on each account.
Look also at the edgar project. It does exctly the same (http://edgar.netflint.net)

Alex
Avatar
sasachess #3
Member since Dec 2005 · 7 posts
Group memberships: Members
Show profile · Link to this post
hi sasachess,

this is no problem with agsXMPP.
You need one account (bot) at google. All users that want to use the web presence have to subscribe to this bot (add it to the roster). This bot gets all the presences and could store it in the memory or a database.

There is sample code that realize it?

The only problem could be the google server. No idea how many presences/users your bot should handle. And how many contacts google will allow on each account.

If necessary, I can use another jabber server.

Look also at the edgar project. It does exctly the same (http://edgar.netflint.net)

Alex

This is very interesting!
Thanks.
Avatar
Alex #4
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
You could take edgar as a sample. Its written in PHP.
How to handle presence and roster you can see in the samples that ship with the library. If smth is not clear then just ask here in the forums.
If you expect lots of users then its the best to setup a own server. But i think google didnt open the s2s communication yet.

Alex
Avatar
sasachess #5
Member since Dec 2005 · 7 posts
Group memberships: Members
Show profile · Link to this post
Quote by "Alex":
You could take edgar as a sample. Its written in PHP.
How to handle presence and roster you can see in the samples that ship with the library. If smth is not clear then just ask here in the forums.
If you expect lots of users then its the best to setup a own server. But i think google didnt open the s2s communication yet.

Alex

I have downloaded edgar.
Now my problem is how to start chat with a user in google talk clicking a button in my web application...

Thanks a lot!
Avatar
Alex #6
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Your web application must be logged in with the user who is the sender of the mesages. Then just create a new message object and send the message.

Alex
Avatar
sasachess #7
Member since Dec 2005 · 7 posts
Group memberships: Members
Show profile · Link to this post
Quote by "Alex":
Your web application must be logged in with the user who is the sender of the mesages. Then just create a new message object and send the message.

Alex

Hi Alex,

I have tried to develop a simple winapp, and I have used the same example for a webapp. The win application work well, but webapp doesn't work... I run my asp.net page under aspnet debugger user. The problem is that the application doesn't connect to server. Can you tell me why? Have I to use different istructions to connect to server? Or have I to set something in VS.net 2003?
Avatar
Alex #8
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello,

do you get some exceptions? When yes can you post them here?
Has your user permessions to open sockets? Could also be a security problem.

Alex
Avatar
sasachess #9
Member since Dec 2005 · 7 posts
Group memberships: Members
Show profile · Link to this post
Quote by "Alex":
Hello,

do you get some exceptions? When yes can you post them here?
Has your user permessions to open sockets? Could also be a security problem.

Alex

OK, this is my sample code:
private XmppClientConnection xmpp;

private void btnLogin_Click(object sender, System.EventArgs e)
        {
            xmpp = new XmppClientConnection();
           
            xmpp.OnReadXml        += new XmlHandler(xmpp_OnReadXml);
            xmpp.OnWriteXml        += new XmlHandler(xmpp_OnWriteXml);
            xmpp.OnLogin        += new ObjectHandler(xmpp_OnLogin);
            xmpp.OnMessage        += new agsXMPP.XmppClientConnection.MessageHandler(xmpp_OnMessage);
            xmpp.OnError        += new ErrorHandler(xmpp_OnError);
           
            xmpp.Port = 5222;
            xmpp.UseSSL=false;
            xmpp.Server = "localhost";
            xmpp.Username = txtUsername.Text;
            xmpp.Password = txtPassword.Text;
            xmpp.Resource = "sasa";           
               
            try{
                xmpp.Open();
            }
            catch (Exception ex)
            { txtDebug.Text = ex.ToString();}
        }

private void btnLogout_Click(object sender, System.EventArgs e)
        {
           
            try
            {
                xmpp.Close();
            }
            catch (Exception ex)
            { txtDebug.Text = ex.ToString();}
        }

private void xmpp_OnWriteXml(object sender, string xml)
        {
            txtDebug.Text += "SEND XML: " + xml;
        }

private void xmpp_OnLogin(object sender)
        {
            txtDebug.Text += "we are logged in to the server now";
            xmpp.SendMyPresence();
        }

private void xmpp_OnReadXml(object sender, string xml)
        {
            txtDebug.Text += "RECV XML: " + xml;
        }

I'm using agsXMPP localhost server example to test my app. There aren't System exceptions. Simply my web application doesn't connect to server.
I think isn't agsXMPP problem but a problem of configuration of my aspnet debugger... I have the same problem also with jabbernet. I use VisualStudio.net 2003.
How can I resolve?
Can you try to test a simple ASP.net page to connect to a jabber server please? It's very important for me... I'm working to my thesis, I'm a final year student.
How can I check if my user have permission to open sockets??

Thanks a lot!
Avatar
Alex #10
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello,

could you upload a sample of a web application as zip file?
Perhaps we can help you and fix the sample.
Did you try to store the xmppCommection as session on the webserver?

Alex
Avatar
sasachess #11
Member since Dec 2005 · 7 posts
Group memberships: Members
Show profile · Link to this post
Quote by "Alex":
Hello,

could you upload a sample of a web application as zip file?
Perhaps we can help you and fix the sample.
Did you try to store the xmppCommection as session on the webserver?

Alex

There is the sample:
my code sample

It's very simple, just for test connection and send a message. I have used your server implementation to test my app in localhost.
How store I the xmppConnection as session?
Avatar
Alex #12
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
i downloaded your code. It logins fine on my machine. But logout and all events dont work.
Im not a aspx developer. So i don't know exactly what is the best way to do this. The problem is that the xmpp session is always null and then of course raises the exception. I think you have to store the xmpp object in a session.

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