chat example is more flexible and better documented