mycustom library and pubsubclient call back

Hi. I am trying to make my own library for my Esp8266 Arduino using ESP8266 library and PubSubClient library. Problem is pubsubclient call back function. According to pubsubclient library owner, issue is that;
library expects the callback function signature to be:

void (callback)(char,uint8_t*,unsigned int)

but I am providing a callback that is a member of a class:

void EspMQTT::callback(char* topic, byte* payload, unsigned int length)

Both the author and me have a little knowledge of C++. May someone help us in this regard? Here are ino, h, cpp and error log files.

ino.txt (510 Bytes)

h.txt (542 Bytes)

cpp.txt (3.46 KB)

Error.txt (1.13 KB)

but I am providing a callback that is a member of a class:

That will work ONLY if the method is static. That will, of course, cause other problems, since static methods can only access static members and other static methods.

There are, of course, workarounds to these issues.

But, the primary question that you need to answer is this: How does the class method know which instance of the class the callback is being called for?

Write a function with the proper signature that calls the function from your class.

I have solved the problem. Here is the solution.