You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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);
}
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) {}
}
}
The text was updated successfully, but these errors were encountered: