4

I'm interested in something based on Jabber but I didn't find a free/opensource one so I'm thinking of writing one.

I've installed a Jabber server and now thinking about the ways in which I can write the client. I'm thinking of one of either these two methods.

1) An ajax call made to a jabber script running on the webserver that takes care of connecting to the server. But then I thought because of the dependencies involved in the jabber client, it might end up consuming too much memory when a few clients connect.

2) The other method is to run a client running as a daemon that takes care of all the heavy lifting. This way I need to have only one instance of the client that sends a spoofed message (sender's name as that of whatever the user entered on the site). A simple script running on the webserver talks to this daemon over some sort of API (XMLRPC or Msgpack maybe?)

I think #2 is better but I'm not sure. Are there other ways I can implement this? I'm considering using Perl or Python for this.

perlit
  • 329
  • 4
  • 13
  • 1
    There are many open-source clients for jabber. Why exactly do you need to build a new one? – Apalala Jan 15 '11 at 18:09
  • @Apalala is so correct, http://www.saint-andre.com/jabber/jsc/ I've used OpenFire with success. Consider the SparkWeb client http://www.igniterealtime.org/sparkweb/ – kenny Jan 15 '11 at 18:10
  • Which ones? The only one I found is http://www.j-livesupport.com/ and that costs $450. Also, I'm not interested in Java based ones. I have a limited amount of RAM on my VPS. I think writing a simple lightweight one is a better idea than something bloated with features I don't need. – perlit Jan 15 '11 at 18:20

2 Answers2

3

Jabber is usually called XMPP nowadays, and there are dozens of clients and servers, something for every language. If you are using Javascript (you mention Ajax), you probably want Strophe. Most servers are modular, so you only load the features you need (consider Tigase, ejabberd, or xmpppy). Writing your own is even worse an idea than it sounds.

Michael Lorton
  • 43,060
  • 26
  • 103
  • 144
  • I've already taken a look at Strophe and I'm not sure if that'll do for me. It looks like the entire client is implemented in Javascript, so I'm not sure if that will work behind restrictive corporate firewalls. I mentioned ajax for polling the server where the real client runs in the backend. As for the server, I'm running ejabberd already :) – perlit Jan 15 '11 at 19:45
  • 1
    Strophe uses BOSH and will go right through any firewall that allows AJAX. – Michael Lorton Jan 16 '11 at 01:27
  • Alright, I'm gonna give it a try. This should be a fun little project. – perlit Jan 16 '11 at 13:50
  • So perlit, which method did you use finally? I need to implement something similar and I'm pretty lost. Thanks. – Mridang Agarwalla Jun 30 '11 at 06:58
1

BOSH

  1. Install prosody because it is really eaSily installed and has BOSH support built-in. You could skip this but then you need to find out how to use BOSH via ejabberd.
  2. use strophe.js to implement this(using BOSH). New browsers support cross-domain request(CORS -> read Proxy-less BOSH part). The old browsers you could use proxy or use flash in the middle as proxy.
  3. read Professional XMPP Programming with JavaScript and jQuery to learn strophe. It even has chapters explaining how to create chat.

Node.js

Or you could consider installing node.js to create your chat system using socket.io.

Community
  • 1
  • 1
Alfred
  • 60,935
  • 33
  • 147
  • 186