Turns out there is specific json format that you need to adhere to while communicating using generic websockets. You cannot just use your json as it is. Below is the format that pubsub expects:
Even for protobuf to work with PubSub, There is also a specific format, but I am yet to figure it out.