Thanks, I can start and stop the Daemon.
My previous code was a library and returned a table of functions, start_server, stop_server, add_client, Remove_client etc which could be called.
When i start the library using the apps.daemon handler, the library runs but then im not sure how to access the fuctions. Can they be called from other scripts? or do i need to adjust the code so the event listener starts when the daemon runs and then use event messages to trigger functions within? or restructure another way?
My resident script looked like this:
local NetworkModule = require("user.CNI_Comms")
-- Start the Copas loop, event listener
NetworkModuletart_server()
-- Add clients using the NetworkModule:add_client method
local client1 = NetworkModule:add_client("x.x.x.x", port)
local client2 = NetworkModule:add_client("x.x.x.x", port)
My previous code was a library and returned a table of functions, start_server, stop_server, add_client, Remove_client etc which could be called.
When i start the library using the apps.daemon handler, the library runs but then im not sure how to access the fuctions. Can they be called from other scripts? or do i need to adjust the code so the event listener starts when the daemon runs and then use event messages to trigger functions within? or restructure another way?
My resident script looked like this:
local NetworkModule = require("user.CNI_Comms")
-- Start the Copas loop, event listener
NetworkModuletart_server()
-- Add clients using the NetworkModule:add_client method
local client1 = NetworkModule:add_client("x.x.x.x", port)
local client2 = NetworkModule:add_client("x.x.x.x", port)