-
Notifications
You must be signed in to change notification settings - Fork 59
Description
The library works great, my only problem is when i reset my arduino a few seconds after the connection is made, it cannot reconnect. I have to reset it a few times. I think its because pusher thinks there is already a connection. Is there a way to ask for a new connection, or reset any old connection? Or is it a bug in the library?
[UPDATE]
I now have the following code to try again after failing to make a connection (not very clean):
int i = 0;
int times = 4;
while(connectedToPusher == false && i < times){
delay(5*1000);
connectToPusher();
Serial.println("again");
i++;
}
if(connectedToPusher == false){
Serial.println("Could not connect, times tried: "+times);
}
boolean connectToPusher()
{
Serial.println("Try connect to pusher");
if(client.connect("8178511e2ae898735fc3")) {
Serial.println("connected");
connectedToPusher = true;
digitalWrite(7, HIGH);
client.bind("ledon", ledon);
client.bind("pusher:ping", checking);
client.bindAll(handleAllEvents);
client.subscribe("test_channel");
return true;
}
else {
Serial.println("failed");
return false;
while(1) {}
}
}