Talked with support they can’t help me anymore than they have, I am sure that my parsing is good, but there is a problem with the code (I think) if there is nothing wrong with the Webhook, the format is in JSON and the webhook worked before but i just don’t know how to get any data to come from the webhook sent to the particle and shown on the lcd screen.
I have changed the code (put the basic code given by in the console) i have switched particles (tried with another one didn’t work (and yes the webhook settings are set to any device), I talked to support I srsly don’t know what to do anymore and I have been working on this project for like 6 months now, HELP!!!
Apart from the fact that it doesn't make sense, you should also avoid using String due to it's internal use of dynamic memory and consequently to potential for heap fragmentation again.
Yeah the String(data) thing was left there from when I was troubleshooting to try and get any data respons,
Anyways now I have 2 errors, one in relations to the mutableCopy:
pubtrans.ino:29:12: ‘mutablyCopy’ was not declared in this scope
and another one which I don’t really know how to fix:
pubtrans.ino:48:67: no matching function for call to ‘CloudClass::publish(const char [23], void (&)(const char*, const char*), Spark_Subscription_Scope_TypeDef)’
And the String was suggested to me from the documentation so thats why I used it, if you have any suggestions, please write!
... which is not how you would publish an event especially since parseData() does not return anything, you can't use its return value in place of an expected const char* parameter
BTW, with your original code you never actually set data to anything useful, so what data do you actually intend to publish?
That was a stupid type-o on my part when I actually had worked out my code, before I gave up a while ago, I didn't have the handler function in the publish part just in the subscribe part of my code...
The problem that I had was that I didn't know where to put the code, so If you could tell me where you actually meant for me to put it would be awesome.
My code looks like this now:
As my code looks like now I have other problems than previously mentioned, why I tried to start a new topic but I will continue it here now since this is not stackoverflow and I don't have to care of starting a new topic every time my hands itch.
The main problems now are these: On my lcd the three lines of next times when the bus is going to arrive are not showing (my lcd is 20x4) and the one time that is showing sometimes just "times-out" and stops showing anything...
E.g. it shows
Next buses:
5 min
and then
Nexti buses:
4 min
and then nothing for some reason and then maybe again
Next buses:
Nu (which means "Now" in swedish)
Any reasons why this might happen, and any ways I can make my particle get a better and faster connection to the webhook, since I feel like it's taking a long time for it to receive the hook-response.
These two lines should replace the strdup() line (#18 in your pastebin) and you'd need to remove the free(mutableCopy) line from the handler.
For the String data = String(data); issue, you can remove that entirely - since you are not actually using data for anything - and just write Particle.publish("PubTrans", PRIVATE) as said above.
To address your other question we'd need to know what the actual input data you are receiving is when that happens.
For that you may want to Serial.print() the entire data string and post it here - or give us a link to the service you are getting the data from, for us to request a set ourselves.
The timing of the webhook response depends for a big part on the time the target server needs to reply. If you watch the event log in Particle Console | Build your connected product you should get a feeling for where most time is lost - it shouldn't be the device<->cloud communication.