I'm pleased with this tool. I couldn't find any other simple cli tool that just reads and writes to WebSockets. Maybe just websocketd: https://github.com/joewalnes/websocketd
I've used websocat for debugging web projects and remote-controlling OBS.
I also have a livereload script that looks something like:
mkfifo $pipe
websocat --server-mode $port 0< $pipe 2> /dev/null &
while sleep 1; do :; done > $pipe &
and a browser userscript like:
// @match localhost
let ws = new WebSocket(`ws://localhost:${port}`)
ws.onmessage = () => location.reload()
so during development I can reload the browser when files change:
find . | entr -s 'echo ping > $pipe'
I've used this script for livereloading PDFs and Markdown previews, not just typical web dev. It's a bit ugly around the edges, but I like how customizable and portable it is between projects and browsers.
I've never used websocat for advanced features, but I'm sure it's quite capable.
I've used websocat for debugging web projects and remote-controlling OBS.
I also have a livereload script that looks something like:
and a browser userscript like: so during development I can reload the browser when files change: I've used this script for livereloading PDFs and Markdown previews, not just typical web dev. It's a bit ugly around the edges, but I like how customizable and portable it is between projects and browsers.I've never used websocat for advanced features, but I'm sure it's quite capable.