mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-22 02:53:09 +00:00
27 lines
412 B
Lua
27 lines
412 B
Lua
local skynet = require "skynet"
|
|
|
|
local command = {}
|
|
|
|
function command.PING(hello)
|
|
skynet.ret(skynet.pack(hello))
|
|
end
|
|
|
|
function command.HELLO()
|
|
skynet.sleep(100)
|
|
skynet.ret(skynet.pack("hello"))
|
|
end
|
|
|
|
function command.EXIT()
|
|
skynet.exit()
|
|
end
|
|
|
|
function command.ERROR()
|
|
error "throw an error"
|
|
end
|
|
|
|
skynet.start(function()
|
|
skynet.dispatch("lua", function(session,addr, cmd, ...)
|
|
command[cmd](...)
|
|
end)
|
|
end)
|