gausma / nodered-contrib-signal-client

Signal communicator client nodes for Node-RED
GNU General Public License v3.0
33 stars 13 forks source link

Receiving message does not work because of lost connection. #25

Open JsBergbau opened 3 years ago

JsBergbau commented 3 years ago

I have this simple example flow

grafik

After some time this node loses connection with signal servers. When I send a message to the number it listens from another signal app, I see that the message isn't delivered to recipient. When I disable the Node und re-enable message is received again.

Can you please have a look?

cthompstone commented 3 years ago

I agree, I mentioned this on here on the 25 April. If my internet drops for a minute or 2, then when the internet comes up again, the receive node never get any messages anymore. I have to disable the receive nodes, re-enable and re-deploy (when the internet is back on). Else the nodes won't work.

KopfKrieg commented 3 years ago

Same problem here. My internet connection went down for a few minutes and the nodes wouldn't send (or even receive?) anything until a restart (note: Using "Restart flows" from the "Deploy" drop-down menu is the easiest solution, just a single click).

I tried to create a workaround (e.g. a timer which restarts the flow), but unfortunately this doesn't seem to be possible. Another alternative would be to restart Node-RED using a timer (systemd-timer, or cron), but this just feels wrong it too many ways.

A fix that detects connection issues and automatically reconnects the nodes with the Signal server would be the best solution.

JsBergbau commented 3 years ago

(note: Using "Restart flows" from the "Deploy" drop-down menu is the easiest solution, just a single click).

Of course thats right. However if you have some complicated flows, that maintain state inside flow context, this gets lost. So this is not an option for me. Some is of course true for restarting whole Node-RED process.

JsBergbau commented 3 years ago

In the used library there is a line about keep alive https://github.com/gausma/libsignal-service-javascript/blob/75fe71a0c63382947e5470d7bfbd4ec74f12efd7/src/MessageReceiver.js#L112 So the question is: Is it a bug in the used library or is the library used incorrectly in the code for Node-RED node? @gausma: Would be great if you could take a look.

KopfKrieg commented 3 years ago

A bit offtopic, but:

However if you have some complicated flows, that maintain state inside flow context, this gets lost.

States should be stored within a global or a flow variable that is backed by a permanent storage. It's more work, but in the end you get a stateless system (stateless as in "restart any time you want, and it will continue where it was"). Not sure if this is possible with your flows, but I recommend to try it :)

JsBergbau commented 3 years ago

@KopfKrieg: I know that. For the important flows I use this system. However there are other flows like temperature alert with hysteresis, done by switch node, Trigger node and msg.reset, like this grafik

So back please back to topic. A lot of offtopic decreases chances to get this fixed, because readers go away because of offtopic.

jwillhoeft commented 3 years ago

I am also having this issue and hope for a soon fix. Meanwhile I tested if a successful send would also reestablish the receiving connection. So, every time the internet link is down and then reestablished, I am getting a message as a workaround. Unfortunately this did not work (sending yes, but not reestablishing receive).

JsBergbau commented 3 years ago

@jwillhoeft Tried the same: Sending regularly messages in hope that receiving connection gets re-established, but no chance. Problem even occurs without internet connection beeing re-established. Also local network disconections will make receive node not receiving anymore.

anosed commented 3 years ago

@JsBergbau I have the same issue. I´m still looking for a simply method to reestablish connection to signal servers. There was never an issue with sending messages, just receiving. Issue can be reproduced by blocking internet traffic for my device (with installed node red) in my router for about a minute. After that, signal instance loses connection for receiving messages. You don´t need to re-deploy whole project and lose unsaved data. In my case renaming “receive node” and deploy only changed nodes is sufficient enough. I hope that helps some of you.

Actually I´m stuck to do this automatically. I moved receive node to its own flow with a link to my processing flow. With admin interface it should be possible to export a flow, alter it, import it and deploy the changed node...

garv3 commented 2 years ago

I've got the exact same issue. The receive node stops working after a while. Sending always works as intended... This has to be fixed.

cthompstone commented 2 years ago

I take it no-one has found a method to detect when the internet goes down and then automatically re-deploy the receive nodes when the internet comes back on? It's a bit of a pain having to keep doing this when my internet stops for a while.

JsBergbau commented 2 years ago

Automatically re-deploying is solution we should strive for. The right solution is to correctly implement some kind of keep-alive in the receiving node.

garv3 commented 2 years ago

Is the dev not even reading this?