Talk to renderd via local unix socket?

I have successfully installed renderd on a linux server and I can access it via CLI like this: `curl -o xx.png 'http://localhost:1234/mymap/8/454/1211.png'`

I can also, locally, telnet to renderd’s apache port and do:


GET /mymap/8/454/1211.png HTTP/1.0


Now, I would like to see if I can talk to renderd’s local unix socket, something like:

curl -XGET --unix-socket '/run/renderd/renderd.sock' 'http://127.0.0.1/mymap/8/454/1211.png'


which outputs:`curl: (56) Recv failure: Connection reset by peer`

I guess I do not know what the communication protocol is. Does anyone know?

Server program must have explicitly bind socket to filesystem, AF_UNIX (in other words, program must support this).

1 Like

The message that renderd expects on its socket is a binary one consisting of the protocol version, the command, the x/y/z tile identification, and - for protocol version 2 - the name of the style. See mod_tile/includes/protocol.h at master · openstreetmap/mod_tile · GitHub - the “command” is essentially a render priority.

For an example of how to send such a message, see mod_tile/src/protocol_helper.c at master · openstreetmap/mod_tile · GitHub

Of course, instead of writing your own code you can also use the render_list binary to send these messages!

2 Likes

thank you, I will use render_list then.