mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-22 02:53:09 +00:00
30 lines
498 B
Lua
30 lines
498 B
Lua
local skynet = require "skynet"
|
|
local snax = require "snax"
|
|
|
|
skynet.start(function()
|
|
local ps = snax.newservice ("pingserver", "hello world")
|
|
print(ps.pub.hello())
|
|
print(ps.req.ping("foobar"))
|
|
print(pcall(ps.req.error))
|
|
print("Hotfix (i) :", snax.hotfix(ps, [[
|
|
|
|
local i
|
|
local hello
|
|
|
|
function subscribe.hello()
|
|
i = i + 1
|
|
print ("fix", i, hello)
|
|
end
|
|
|
|
function hotfix(...)
|
|
local temp = i
|
|
i = 100
|
|
return temp
|
|
end
|
|
|
|
]]))
|
|
print(ps.pub.hello())
|
|
print(snax.kill(ps,"exit"))
|
|
skynet.exit()
|
|
end)
|