The Elemental Chat app uses it heavily; @ddd-mtl’s SnapMail uses it (???); pretty much all chat-like apps rely on this thing called Signals to be able to propagate incoming messages all the way to the UI. And looks like Signals have been a part of Holochain since even before RSM! Yet, I couldn’t find any extensive explanation of how they work (neither on docs.rs, nor on Holochain blog, nor on this forum, nor on Wasm Workspace’s test utils, nor on @guillemcordoba’s Holochain Gym, nor anywhere else).
Basically, here’s what I’ve understood thus far:
You expose one of your extern functions to other remote users via capability grants; thus, I, for example, when messaging you, can call that remote function on your node that will throw a signal at you (if you happen to be online, of course), i.e., it will somehow magically ring a bell and make your UI update its messages list to poll that new message too. But how does this magic happen? Does the UI open some special WebSocket connection with the conductor just for incoming signals? How do Signals save the UI from having to repeatedly call some fetch_new_messages() extern function? Also, is the implementation of Signals hiding some HDK-callbacks under the hood that I’m unaware of? I’m clueless! PLEASE HELP!!!
A step-by-step explanation of how Signals get propagated all the way to the UI would be very helpful, indeed…
[cc (besides the above two): @pauldaoust, the master explainer]
Oops! I last visited developers.holochain.org a long long time ago; back then, if memory serves well, I think this entry on signals wasn’t there… I had no idea Paul (or whoever else) had been updating those pages silently behind the scenes… What a fool I am… Anyway, thank you so so much! That illustrative explanation was all I was looking for. Gonna read it out right away… Thanks, really.
Signal pattern is implemented and used in Kizuna hApp. In the next session of Holochain-in-Action which is Technical Deep Dive 3 of Kizuna, @tats_sato is going to cover this topic.
Part 2 Video,
Part 1 Video:
You can also participate in the live session and ask your questions.