31 lines
1.0 KiB
Plaintext
31 lines
1.0 KiB
Plaintext
WS_PORT ?= 8080
|
|
WS_SERVICE ?= 127.0.0.1:$(WS_PORT)
|
|
|
|
WS_TARGET_SERVICE ?= pong
|
|
WS_TARGET ?= unix:/tmp/.libipc-run/$(WS_TARGET_SERVICE)
|
|
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) $(WS_TARGET)
|
|
|
|
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
|