What's the safest way to encrypt a messenger application? How can I safely encrypt a messenger application that sends data over the Internet via TCP?

I've already taken a look at Salsa20, but I don't know if that's a good algorithm to use for this.

What algorithms can I use for this and how secure are they?
Writing a secure messenger application is difficult, and vulnerabilities have been found, and keep being found in all of them.

This requires far more than just a stream cipher such as Salsa20. An entire protocol has to be designed for user registration, key exchange, group invites and more.

The MLS working group is currently designing a reference protocol to do group messaging.

Meanwhile, Signal has opensourced their core library (https://github.com/signalapp/libsignal-protocol-c), and this is something you may want to look at.

Wire, another popular application with fairly decent security, has also opensourced most of its components: https://github.com/wireapp

But I wouldn't recommend starting from scratch, especially if you are new to cryptography.