Recommended way to connect sockets within drivers on start-up

Hi there,

I'm developing a driver which connects to a relay board via tcp socket;

I have used the interfaces.rawSocket.connect method to establish the connection. The driver is working fine atm.

what is the usual/recommended way to startup a socket connection and to keep it alive?

I currently had the connection setup to start on device creation and a refresh loop to run every 5 minutes (using runEvery5Minutes).

I think I'm onto something.

Adding the capability "Initialize", has provided me with what i was looking for, in regards to start-up.

is there a more detailed version of the capabilities help? it would be good to have found a description of what the capabilities do. For this one it could say when the initialize method is expected to be called.

Unfortunately the developer documentation isn’t the greatest. Your best bet is often to ask here. And yes, Initialize is what you want.

Thank you for the quick answer

just to name the beasts:
With the "initialize" capability I could implemented the startup tasks
and with the scheduler (runEvery1Minute) I could implemented the keep-alive

Download the Hubitat app