The API takes a ChatConfig object which has a conversation field you can set to chat in the same conversation,
The chat() API returns a ChatResponse object which has the same conversation field that gives the current conversation ID. Use this ID in your next chat() request.
In the web XML API, the conversation is an attribute in the chat message and response XML. In the web form API, the conversation is a form parameter.