且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Google协议缓冲区和HTTP

更新时间:2023-01-25 09:13:27

具有HTTP请求的二进制有效载荷,或在HTTP响应中。只需将协议缓冲区的字节直接写入请求/响应,并确保将内容类型设置为application / octet-stream。客户端和服务器应该能够轻松地处理休息。我不认为你需要任何更加特别的任何一端。

You can certainly send even a binary payload with an HTTP request, or in an HTTP response. Just write the bytes of the protocol buffer directly into the request/response, and make sure to set the content type to "application/octet-stream". The client, and server, should be able to take care of the rest easily. I don't think you need anything more special than that on either end.