I tried implementing a UNIX socket handler (L58) in Go  in the following file. Would you consider this OK, valid, or correct?

The `.sock` file is cleaned up on `ctx.Done()`. I kind of achieved my goal. I have to add a pre-cleanup in case of an ungraceful shutdown. However, in case of a canceled context, it works right now

https://forgejo.lukasrotermund.de/lrotermund/libre-activity-tracker/src/branch/wip-tracker-and-socket/internal/tracker/socket_server.go

#go #golang #UnixSocket

Cookie monster!

I love how simple UNIX sockets are! All you have to do is add a listener to a file handle and send random bytes as data to the socket file, e.g. via `echo "hello world" | socat - UNIX-CONNECT:/tmp/myproject1000/mysocket.sock`.

Playing around with it is so much fun  

#UnixSocket #go #golang

Are there standardized responses for UNIX socket connections? For example, `OK\n` or `ERROR\n` for unknown commands? Or is it totally up to the implementation?

#unix #UnixSocket #linux

@lukasrotermund
Guessing: totally up to the implementation. My assumption is based on "unix sockets are just sockets". You can run an http server or a video stream through a unix socket; on protocol level there is no commonality.

Happy to be corrected by people that _actually_ know!