Added message parsing code for javascript client.