We do that on our
football3s.com application. In our case we did it
by writing bots (in ruby, using xmpp4r, but you could use whatever
language floats your boat), the bots live on the server, and joing the
same XMPP chatroom as the hemlock client, and send events into the
chatroom for the clients to display. The bots, in our case, connect
to the database.