On the server side operate two WCF services - ChatService and ChatSupportService. The client side communicates with those services using HTTP requests and receives data in the JSON format.
<your website URL>/CMSModules/Chat/CMSPages/ChatService.svc/JS
The client side receives objects with data and generates HTML. To do so, it uses a jQuery plug-in called Templates. Using the templating system on the client side allows chat to work without requesting pages and still offer flexibility similar to Kentico macro language (K#). jQuery Templates documentation and syntax description can be found at https://github.com/BorisMoore/jquery-tmpl.
To learn more about the templates and how to use them to customize the chat module, refer to the Writing transformations for chat topic.