How can i include cayenne functionality in an sketch that already has WiFi running?

how can i include Cayenne functionality in a program that already has WiFi started elsewhere?
Should I use
-Cayenne.begin(username, password, clientID); with only three arguments?
-Use empty SSID/password?
-Something else?
-That is not possible?
Thank you for explaining.

yes, that should work.

It looks like it were halfway working, but frankly: the 2 instructions:

Cayenne.virtualWrite(0, myVariable);

take more than 1 second to execute?

It took me some time to figure out, but it really takes longer than 1S, so it blocked my sketch completely.

i am not sure, why it is taking so long for you. but for me it is this:

[37067] Publish: topic 1, channel 0, value 37067, subkey , key 

and that time is in the millisecond.

And also are you publishing data from main lopp?

It is the cayenne(loop); instruction that takes that long.
In the example it is placed within the loop.
Is it only required at the beginning once?

are you referring to Cayenne.loop(); then that also takes very very short time to execute. It is used to keep the connection live.

Yes, I mean Cayenne.loop().
Every time I run it, it blocks all the other tasks for ~ 1,3 second.
But the sketch seem to run fine when I invoke Cayenne.loop() only once in Setup.
I am sending at one second pace anyhow, so nothing is needed to keep the connection alive.

Cayenne.looo() function must be called regularly. This allows the client to maintain the connection and check for any incoming messages. As sending data at one-second interval is not best practise Sending MQTT messages within rate limits

As sending data at one-second interval is not best practise

But in my case (sound level logger) that pace is required.
The measurement is extremely reactive.
I must even process the signal internally every 125mS

gathering data and processing can be done at any rate, only publishing of gathered data should be done at rate limit interval.

The results must -according to DIN Standards- be recorded at a one second tick, so I must publish at that rate.
Apparently sending one small message per second and some additional stuff every hour seems to be tolerated. It is less than 2% above the limit…

if you continue to send data above the rate limit then the device will get blocked as mentioned in the post. upto you now whether you want to continue or not.