ngx_lua连接swoole,


ngx_lua有时候要和其他端任务交换,例如和php,python等,常见的是gearman,不过php7以上就不支持gearman了,然后引进了swoole或者beastack等,然后就有了下面的代码,把


    --通过ngx_lua给swoole传数据
    local swoole=require "luaswoole" --需要安装luaswoole.so
    local client = swoole.new()
    local err = client:connect("api.swoole.yufei.com",9090)
    if err then
        ngx.say(err)
        return
    end

    local data = client:sendRecv(ok) 
    if data then
        ngx.say(data)
    end

    client:close()

相关内容

    暂无相关文章