You should put them in a subdirectory of $XDG_RUNTIME_DIR
if the variable is set. See the XDG Basedir Standard: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
If it's not set, there are a few places to consider. Many distributions have systemd (or something) create /run/user/<user-id>
when a user logs in, so it might be the best place to start looking if $XDG_RUNTIME_DIR
is not set. If that fails I fall back to putting things in /tmp
. You might try to create a directory within /tmp named randomly or after the username/id with your application name, chown
it to the user of the app, set any appropriate permissions, then put sockets in there.