fix client_id and msg being truncated by middleman and change length to be calculated programmatically instead of hardcoded