simplex-chat / simplexmq

⚙️ SimpleXMQ - A reference implementation of the SimpleX Messaging Protocol for simplex queues over public networks.
https://simplex.chat
GNU Affero General Public License v3.0
470 stars 55 forks source link

SimpleX uses previously configured SMP servers when custom SMP server is entered for previously created contacts #485

Open UnknownHiker opened 2 years ago

UnknownHiker commented 2 years ago

Im actually not entirely sure if this is an issue or my fault. Sry in advance, if i just didnt understand something crucial.

So i've setup a SMP Server on Ubuntu 2204 LTS using the latest binary, like its described in the Documentation, and in General this all seems to be fine:

Jul 25 18:41:58 systemd[1]: Started Simplex SMP Server. Jul 25 18:41:58 smp-server[2068]: SMP server v3.1.2 Jul 25 18:41:58 smp-server[2068]: Fingerprint: (removed, not for the public....) Jul 25 18:41:58 smp-server[2068]: Store log disabled. Jul 25 18:41:58 smp-server[2068]: Listening on port 5223 (TLS)... Jul 25 18:41:58 smp-server[2068]: not expiring inactive clients Jul 25 18:41:58 smp-server[2068]: server stats log enabled: /var/opt/simplex/smp-server-stats.daily.log

I entered the SMP server in my terminal Client, as well as in my Android App using smp://fingerprint>@<ip:5223, ofc replaced with my individual fingerprint and ip. Both clients accepted it.

Now i wanted to test if the messages are delivered over my server, so i turned off the Terminal Cient, and sent a Message from my Android Device. Then i turned off Simplex Chat on Android in the Settings, and enabled my Terminal Client, and reveived the message, so it must have passed some server, as no direct connection should have been possible. Alright.

Then i tried same again, but turned off my SMP Server before, and miraculously the messages still arrived, without P2P connection, and SMP Server turned off? So i thought there must be some fallback, even if you have customized a own SMP, is that right? How can i ensure, that my own SMP Server ist used? (at least if both chat partners customized the same one) Or did i just get wrong, how this whole System works?

I also tried it, with having my phone in the mobile network, and Terminal Application in my home wifi, getting the same result.

Thanks in advance for any ideas :)

Edit: I know this is supposed to be decentralized, but at least i thought it would dispatch my messages over my server if i customize one...

epoberezkin commented 2 years ago

Thanks for the question - it highlights what we have to improve, I will explain.

To receive the messages for each contact a different server can be used - the one that was configured at the time the contact was created. Changing the server in the configuration only affects the contacts that would be created after that, it doesn't automatically move messaging queues for the existing contacts to the new server.

This is going to change once we add queue rotation - once the queue is rotated it would move to the server that is configured at the time of rotation, but it won't be instant too - as rotating queues would require some coordination with another user's client.

We are going to add - I am actually working on it right now - the visibility of which servers are used for each contact to receive and to send messages (and you only control the servers used to receive messages, the servers you use to send messages are controlled by your contacts).

We also need to add some comment on server configuration page to clarify it.

UnknownHiker commented 2 years ago

Thanks for the clarification, that helped me a lot to understand it better :)