Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What do you think about a rebrand? How about jRPC?


There are some conventions that modern infrastructure expects.

For example client does the request, some proxy intercepts the request, checks some things, then forwards the request. Another reverse-proxy on the server side again intercepts the request and routes it to the final web server.

If one of the proxies receives HTTP 5xx, it might perform few retries.

Devops people want to have some meaningful info in the URL, so they can write some security or routing logic.

It might be useful for devops people to have not just 400, but many different response codes, like 400, 401, 403, 404 for different situations. They'll make metric out of it and set up an alerts.

So if I would design modern RPC, I'd go the following route:

1. Do not make it protocol-agnostic, but rather embrace HTTP. Method+URL should contain routing information (jsonrpc method field). Errors should have a way to map on HTTP response codes. It does not mean that it's impossible to use it over say websocket, you just need to wrap it with HTTP-like structure.

2. Do not bind it to JSON-only. There should be a way to provide request parameters via URL query parameters, via JSON body and via protobuf body. Good server implementation should respect Content-Type and respect Accept HTTP headers. So I can call that method via cur, via some JS code or with optimized protobuf mobile SDK. JSON should be the main target, though, other encodings should be mapped to JSON.

3. Support meta-information, probably using something like JSON Schema or OpenAPI.

4. HTTP Method must be used as a caching and idempotency information. GET responses are cacheable. POST is not idempotent, etc.

Actually it might look a little bit like REST. But I just tried to extract the most useful parts out of it and remove useless parts like coding some parameters in URL Path or the whole philosophy about entities and stuff. If you don't want to think about caching and idempotency stuff, you just use POST for your endpoints and that's perfectly fine.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: