Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Having a chat frame in your web page is really easy if you use WebSockets and can run a simple chat engine on your server (some hosting services don't allow sockets at all)

Since WebSocket is not available everywhere yet, use a Flash interface (pure actionscript, no visuals) with the same methods: onopen, onsend, onreceive, onclose, to communicate with the server. So when WebSockets is available all you have to do is replace the flash object with the real stuff.

  mychat = new WebSocket(chatserverurl);
  mychat.send("Hello");
  mychat.send("Can you hear me?");
  mychat.send("Am I getting through to you");
Don't get confused, the chat client is pure html, not flash, and can be easily spiced up with some jquery effects.


We've used Strophe to implement a pure-javascript/html chat like this (with an XMPP server on the other end, and jetty handling proxying of non-blocking asynchronous comet long-polling requests to the XMPP server).

XMPP supports this natively via its HTTP binding specification, and there are free open source servers such as openfire that will work with Strophe out of the box.

http://code.stanziq.com/strophe/ http://www.igniterealtime.org/projects/openfire/index.jsp




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: