I'm not sure which format Apollo uses to transport data, but if it's JSON have a look at MessagePack. This might lead to faster load times. If that's not interesting, please close this issue right away :-)
Right now none of the GraphQL servers support this as a response format, so it wouldn't help much to add it to the client. And I haven't seen this be a bottleneck in performance, so I think we should wait until there is a big need to switch.
Sorry for necroposting, but yes, adding MessagePack to GraphQL can provide many benefits, especially for subscription streaming via WebSocket, it could save a lot more bytes than usual ;)
With kawanet/msgpack-lite, msgpack artifacts are trivial to generate (and consume) from JS objects, so in theory this is an in-place upgrade to the traditional JSON data output.
Proposal: Apollo should be able to determine msgpack data via the use of Content-Type
HTTP header, i.e. Content-Type: application/(x-)msgpack
. Just feed the data to msgpack.(en|de)code
and you could get the same JSON request data but smaller馃槃And is useful to mobile platform
Looks like Message-Lite is the fastest Node implementation. It is used by GraphQL-Crunch, whose docs show how it can be integrated with Apollo server and client: https://libraries.io/npm/graphql-crunch
@JohnTParsons I was intrigued by your suggestion that graphql-crunch
used MessagePack
but when I looked at it, it doesn't seem to. Do you have more information about how graphql-crunch
uses MessagePack
?
Most helpful comment
Sorry for necroposting, but yes, adding MessagePack to GraphQL can provide many benefits, especially for subscription streaming via WebSocket, it could save a lot more bytes than usual ;)
With kawanet/msgpack-lite, msgpack artifacts are trivial to generate (and consume) from JS objects, so in theory this is an in-place upgrade to the traditional JSON data output.
Proposal: Apollo should be able to determine msgpack data via the use of
Content-Type
HTTP header, i.e.Content-Type: application/(x-)msgpack
. Just feed the data tomsgpack.(en|de)code
and you could get the same JSON request data but smaller馃槃And is useful to mobile platform