Swift Chat Application

I am currently using Swift to create a text chat application with SkyWay. I have no problem connecting to the chat and using P2P, but I am having trouble with the availability of new arrivals before connecting to the chat.
How can I determine if there are any new messages?