timum-viw / socket.io-client

A socket.io-client implementation for ESP8266 and Arduino
228 stars 90 forks source link

socket.on("disconnect", handler) not working #47

Closed RobertHolscher closed 5 years ago

RobertHolscher commented 5 years ago

In the documentation you write that the disconnect event is triggered when the connection is lost with the server. I am trying to use that with the arduino sketch but the compiler says: No matching function for call to 'SocketIoClient::on(const char [11], void(&)())'

The call I am using is webSocket.on("disconnect", disconnectevent);

The disconnectevent is the handler Am I using it wrongly ?

coma0815 commented 5 years ago

Do you have a matching function called "disconnectevent"? In my sketch it would look like this:

void disconnected(const char * payload, size_t length) {
    // do something when disconnected....
}

webSocket.on("disconnect", disconnected);
RobertHolscher commented 5 years ago

Thank you, forgot to put in the (const char * payload, size_t length), overlooked that. Thanks for your reply

RobertHolscher commented 5 years ago

It compiles ok now , case closed