Event Forwarding

Top  Previous  Next

If you have multiple Girders running you might want to have events automatically forwarded to Girders running on different machines. With Girder Pro this can be done with a few simply steps. This example will show how to forward all PIR-1 events.



We'll be using the gir/triggerEvent.lhtml script to trigger events in the remote Girders, so make sure you enable the webserver on each Girder. Then collect the IP addresses of the remote Girders.


On the Girder instance that has the event source, in this case the PIR-1 attached add a scripting action to the tree and enter this script:

if not event then

    print("This action must be triggered by an event.")






-- Edit this list to suit the Girder's you have running

-- make sure those Girders have the webserver enabled.


-- Adding localhost is probably not a good idea as you will

-- get an infinite loop. You have been warned. 



local pcs = {

 [1] = "",

 [2] = ""



for index, host in ipairs(pcs) do


    network.get( "http://" .. host .. "/gir/triggerEvent.lhtml?es=" .. socket.url.escape(event.event) .. "&ed=" .. socket.url.escape(event.device+1) .. "&km=" .. event.modifier )



The important part for you to adjust is the pcs table. Make sure the entries match your IP addresses, you can have as many entries as you need here. Also please don't add the current instance as that will lead to infinite event loops, which will make Girder very busy shuffling events around to no avail.

The last part we need to take care of is the event node on the tree that will trigger this action. Since we want all PIR-1 events to trigger the action we'll use a regular expression to match all events. ( .* )


That is all that you'll need to setup to make this work!