Communications with Two user Ip

any way for Communicate two user in site? like user1 click in name user2(whith Ip) and send message . i know with database and ajax can save message and send to user2 but its slow and not suitable. i want Simulation private chatroom and save message history As long as jquery dialog open . i found this but i dont know is suitable . any one have any idea?

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');

Top code in site

Using WebSockets could be a solution? http://www.websocket.org/

This lends it self to a chat system, so you can use Push rather than Pull to check for messages?

use socket.io - it provides WebSockets and a couple of fallbacks for shitty IE's