diff --git a/crystal/makefile.user b/crystal/makefile.user new file mode 100644 index 0000000..8d2a41f --- /dev/null +++ b/crystal/makefile.user @@ -0,0 +1,26 @@ +WS_SERVICE ?= 127.0.0.1:8080 +init-websocket-tcpd: + @# '-b' binary, '-E' quit on end-of-file, 'ws-l' websocket URI to listen + @# each connection is redirected to last parameter + websocat -b -E ws-l:$(WS_SERVICE) unix:/tmp/.libipc-run/pong + +init-websocket-client: + @# websocat -b -E tcp-l:127.0.0.1:9000 ws://127.0.0.1:9999 + websocat -b -E ws://$(WS_SERVICE) + +# +# The following rules help for debugging stuff. +# Changes can happen from time to time depending on what I'm working on. +# + +TCP_SERVICE ?= 127.0.0.1:9000 +init-websocket-ipc-unix: + @#websocat -b -E ws-l:$(WS_SERVICE) tcp:$(TCP_SERVICE) + @#websocat -b -E ws-l:$(WS_SERVICE) | ./bin/input2ipc | nc -U /tmp/.libipc-run/pong + websocat -b -E -s 8080 | ./bin/input2ipc | nc -U /tmp/.libipc-run/pong + +# 1. read TCP messages (nc), +# 2. convert them into IPC messages (input2ipc), +# 3. send them through websocket (websocat). +init-tcpd-ipc-websocket: + nc -k -l 9000 | ./bin/input2ipc | make init-websocket-client