Hi daniellerego,
Thanks for visiting Apple Support Communities.
It sounds like your iPhone 5s is not staying connected to Wi-Fi networks.
As a starting point, see the troubleshooting steps in this article:
If your iPhone, iPad, or iPod touch won’t connect to a Wi-Fi network - Apple Support
If you've already tried the more common steps such as toggling Wi-Fi off and on, and restarting your iPhone, be sure to try this one:
Reset your Network Settings.
Tap Settings > General > Reset > Reset Network Settings. This also resets Wi-Fi networks and passwords, cellular settings, and VPN and APN settings that you’ve used before.
If you're not receiving Messages reliably either, you can find some additional troubleshooting steps in this support article:
If you can't send or receive messages on your iPhone, iPad, or iPod touch - Apple Support
Sincerely,
Jeremy