I think that most people people coming here are looking to do this on client side, in client/server web applications
Sam is not made for this, but to connect servers together - systems in fact. See http://project-sam.awardspace.com/overview.htm
Since PHP is stateless it is really hard to do collaborative applications with a PHP back-end and very few solutions exist. So, for those looking for this, I put here a link to a messaging server in PHP - free open source and community driven: http://php-polling.sourceforge.net/
Hoping this will make you save time!