Jabber-net integration

2019-05-21 02:31发布

问题:

I'd like to ask your help regarding having a Google Talk Bot that will communicate with my code on my server.

I have downloaded Jabber-Net from code.google.com, but the examples there are not enough... I am new to these technologies, and have no clue about:

  1. How will client arrive to my server? where should I change [if any] DNS to my server?
  2. Which server side library should I use?
  3. From the examples I understood that I need to have a Desktop-app running in the background constantly, which doesn't make sense to me.

Does anyone has an example of some better references to understand this better? [Sorry for my ignorance...]

回答1:

  1. I'm not sure if I understand what you ask correctly. If you're asking how to connect to chosen server, console sample shows how to do it simply, you basically fill out JID class. Sample from Jabber-Net
JabberClient jc = new JabberClient();
JID j = new JID(jid);
jc.User = j.User;
jc.Server = j.Server;
jc.NetworkHost = networkHost;
jc.Port = port;
jc.Resource = "Jabber.Net Console Client";
jc.Password = pass;
jc.AutoStartTLS = TLS;
jc.AutoPresence = initialPresence;
  1. If you want to create your own server, there's a library (also running under .NET) called agsxmpp, it allows to create both, server and client, it's open source on MIT/GPL license afair. I don't know if jabber-net enables this feature. On the other hand, there are plenty of free jabber-server if you don't want to just use one of "public" ones, so it may be worth to consider just using something that is ready to be launched.

  2. There's a console sample in the project, you don't need desktop-app (if this is what you were asking?), so you can write service, console app or anything else.



回答2:

Here's a recent post that shows an example of replying to incoming messages on Gtalk using .NET