4 thoughts on “Contact

  1. kjetil

    Hi Marco!

    I just downloaded and tested your ArduinoPusher library. Awesome work!!
    Finally a library who got the private channel authorization working.

    But I ran into problems trying to bind a channel to a function.

    Just tried a very simple example. Used your private channel example code and added:
    PusherClient client;

    client.bind(“my-event”, handleMyEvent);

    void handleMyEvent(String data){
    Serial.println(“Data mottatt:”);
    Serial.println(data);
    }

    But i keep getting this error message:
    working.ino: In function ‘void setup()’:
    working:24: error: invalid conversion from ‘void (*)(const String&)’ to ‘void (*)(const String&, const String&)’
    working:24: error: initializing argument 2 of ‘void PusherClient::bind(const String&, void (*)(const String&, const String&))’

    Do you have any idea what it could be?

    Thanks again for some awesome piece of code 🙂

    Regards Kjetil

    Reply
    1. marcoaltomonte Post author

      The error simply states that your handleMyEvent function should have two arguments of type const String&, while your has only one.

      So try to replace it with the following:
      void handleMyEvent(const String& name, const String& data){
      Serial.println(“Data mottatt:”);
      Serial.println(data);
      }

      I modified the delegate function to have two parameters. Maybe I did not fix some readme in the library.

      Reply

Leave a comment