diff options
Diffstat (limited to 'spec/startup_spec.lua')
| -rw-r--r-- | spec/startup_spec.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/startup_spec.lua b/spec/startup_spec.lua index 45fa996..dacf9e9 100644 --- a/spec/startup_spec.lua +++ b/spec/startup_spec.lua @@ -80,4 +80,17 @@ describe("nng",function() assert(avg > 0.4)
assert(avg < 0.6)
end)
+ it("should be able to use publish and subscribe sockets to transfer information", function()
+ local s1 = assert(nng.pub0_open())
+ local s2 = assert(nng.sub0_open())
+ local s3 = assert(nng.sub0_open())
+ assert(s1:listen("ipc:///tmp/pub.ipc"))
+ assert(s2:subscribe(""))
+ assert(s3:subscribe(""))
+ assert(s2:dial("ipc:///tmp/pub.ipc"))
+ assert(s3:dial("ipc:///tmp/pub.ipc"))
+ assert(s1:send("hello 1"))
+ assert(s2:recv() == "hello 1")
+ assert(s3:recv() == "hello 1")
+ end)
end)
|
