mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-22 19:13:07 +00:00
20 lines
473 B
Lua
20 lines
473 B
Lua
local skynet = require "skynet"
|
|
local client = ...
|
|
|
|
skynet.register_protocol {
|
|
name = "client",
|
|
id = 3,
|
|
pack = function(...) return ... end,
|
|
unpack = skynet.tostring,
|
|
dispatch = function (session, address, text)
|
|
-- It's client, there is no session
|
|
skynet.send("LOG", "text", "client message :" .. text)
|
|
local result = skynet.call("SIMPLEDB", "text", text)
|
|
skynet.ret(result)
|
|
end
|
|
}
|
|
|
|
skynet.start(function()
|
|
skynet.send(client,"text","Welcome to skynet")
|
|
end)
|