lua: add 'defer_request' and 'complete_deferred_request' functions
[project/ubus.git] / lua / subscriber.lua
1 #!/usr/bin/env lua
2
3 --[[
4   A demo of ubus subscriber binding. Should be run after publisher.lua
5 --]]
6
7 require "ubus"
8 require "uloop"
9
10 uloop.init()
11
12 local conn = ubus.connect()
13 if not conn then
14         error("Failed to connect to ubus")
15 end
16
17 local sub = {
18         notify = function( msg )
19                 print("Count: ", msg["count"])
20         end,
21 }
22
23 conn:subscribe( "test", sub )
24
25 uloop.run()