websockets: Return JSON in all cases

We return a json object which always contains a status, and optionally
contains a result. The type of the result varies.