snax : a simple skynet auxliliary framework

This commit is contained in:
Cloud Wu
2014-04-16 20:12:17 +08:00
parent a420fe498f
commit df5c619a29
6 changed files with 235 additions and 22 deletions

View File

@@ -1,10 +1,11 @@
local skynet = require "skynet"
local snax = require "snax"
skynet.start(function()
local ps = skynet.uniqueservice("pingserver")
skynet.watch(ps)
print(pcall(skynet.call,ps,"lua","ERROR"))
print(skynet.call(ps, "lua", "PING", "hello"))
print(skynet.call(ps, "lua", "PING", "hay"))
skynet.call(ps, "lua", "EXIT")
local ps = snax.newservice ("pingserver", "hello world")
print(ps.pub.hello())
print(ps.req.ping("foobar"))
print(pcall(ps.req.error))
print(ps.kill("exit"))
skynet.exit()
end)