Limit history size

Limits number of messages sent to client and number of messages saved in database.

Features courtesy of Caltrain