JSON over TChannel
This document outlines how we encode JSON over TChannel.
For JSON call requests the
as (arg scheme) transport header must be set to
json. Requests will be made with
call req messages and responses will be
call res messages, with values for
defined in Arguments.
call req, the service name should be set to the TChannel service
call res, the response code must be set to
0 if the response was
successful and the response code must be set to
1 if the response was a
call req and
arg1must be the method name as defined by [
arg2must be the application headers encoded as JSON
arg3must be the application response as defined by [
The method name must be a UTF-8 string. It's recommended that you use
alphanumeric characters and
arg3 must be encoded as JSON.
call req messages this is just an arbitary JSON payload.
call res messages:
- In the case of success the response is an arbitrary JSON payload.
- In the case of failures the response is a JSON encoded error. It's
recommended that errors have a
messagefield that is a human readable string and a
typefield that's a static string identifying what type of error it is.