No, it means what you said about the service. Actually some CLI where you can pipe in some random message would be perfect. Then we can just send “Hello, world.” and it goes through. That’s perfect.
@Nemael could you look into this code and extract the encoding part so we can have just that? I can imagine something like this: cat file.txt | upsycle-send mr-a.dream.public.cat that writes out the response from the router.
All right. The thing is, is that we already have services; although they do not work
exactly as you describe (you cannot give a string or a file.txt as argument for a message),
but they send random messages (some of the arguments are randomly generated) to MR’s after key-strokes.
Tweaking this service to do what you want (i.e. be able to give a file.txt as argument) would be way easier than to write a new service, since the whole ‘establishing a connection’, and 'make a valid message from a string" part is already done there.
Having a simple way to demonstrate a “live message” among random ones would offer a great confirmation for the sceptical mind. Another step would be for the destination service to be able to print it out in the log once it received it, or somehow display the content of this specific message, I guess that would require a specific destination service that not only count messages but decodes them.
Sure, I agree with that. The printing step we already have. It is printed on the screen right now; you should be able to find it once you have an MR and a service running (e.g. MR a and Svc a1), and send a message from the service to the MR (use h for a help message to see how to do this).
I guess it would be good to do a git pull and opam install --deps-only --with-test . in the upsycle-router directory, to be sure that h works.
The body of the message can be seen in the screen of the MR.
@how if I understand correctly you want to simulate what the keyboard does, without needing a keyboard, so you can demonstrate different scenarios. Yes we can do this. I think a TCP socket would work better than signals, also because it needs to work between machines and not just on the same machine.
So your ‘file.txt’ consists of, say:
# --- contents of file.txt:
n
n
n
and then you want to do
cat file.txt | upsycle-send mr-a.dream.public.cat
and it will have the same effect as if you had pressed ‘n n n’ on the keyboard. Is this correct?
upsycle-send () {
local host=$1
local port=$2
local line
while read line; do
nc "$host" "$port" <<< "$line"
done
}
cat > file.txt # e.g. n<enter>S<enter><ctrl-d>
cat file.txt | upsycle-send 127.0.0.1 7001
But to make a nice demo you probably want to send a few commands to the message router A, then to service A1, then to the message router or another service, etc. It might an idea to make a little DSL for this.
s-a1 j # join multicast groups
sleep 5
s-a1 m # send multicast update
mr-a S
with mappings mr-a=mr-a.dream.public.cat:7001, s-a1=dmc-1.dream.public.cat:nnnn in another file.
and then eventually
s-a1 join-multicast-groups <key1> <key2>
sleep 5
s-a1 send-multicast <key1> "hello this is a DMC update"
mr-a show-state