multicast support remote publish/subscribe

This commit is contained in:
Cloud Wu
2014-04-29 21:56:58 +08:00
parent fa6191d9ed
commit 5ce65055d2
6 changed files with 153 additions and 19 deletions

View File

@@ -1,5 +1,6 @@
local skynet = require "skynet"
local mc = require "multicast"
local dc = require "datacenter"
local mode = ...
@@ -13,6 +14,7 @@ skynet.start(function()
print(string.format("%s <=== %s (%d)",skynet.address(skynet.self()),skynet.address(source), channel), ...)
end
})
skynet.ret(skynet.pack())
end)
end)
@@ -23,9 +25,12 @@ skynet.start(function()
print("New channel", channel)
for i=1,10 do
local sub = skynet.newservice("testmulticast", "sub")
skynet.send(sub, "lua", "init", channel)
skynet.call(sub, "lua", "init", channel)
end
print("set channel", channel)
dc.set("CHANNEL", channel)
print(skynet.address(skynet.self()), "===>", channel)
mc.publish(channel, "Hello World")
end)