Open ivanlewis opened 8 years ago
You just need to send a ping to whatsapp. It´s servers log you off after a timeout of 300 seconds.
Just initialize a new thread that sends a ping every random number between 100 and 300 seconds.
//Declaring thread private Thread threadPing; private volatile bool pingIsRunning = true;
//Method that sends ping private void ThreadPing() { while(pingIsRunning) { Random random = new Random(); Thread.Sleep(random.Next(100000, 300000)); WhatSocket.Instance.SendPing(); } }
Then start the thread when you logg in this.threadPing = new Thread(new ThreadStart(ThreadPing));
Ok Thank you so much.
My second question is Why there is need to use
while (wa != null)
{
wa.PollMessages();
Thread.Sleep(100);
continue;
}
how to keep server whats app account logged in always?
I want to create a chat server where users will send messages or ask questions accordingly i want to send the replies.
Why there is need to use threading : while(true)