Open Rajasekhar-topgear opened 4 years ago
Hi, @Rajasekhar-topgear , you can use a zero-delay timer to raise your connection, just refer to here: https://github.com/openresty/lua-nginx-module#cosockets-not-available-everywhere
Hi, @rainingmaster, Thanks a lot for your reply.
OK, I understood that, "resty" utility is running under context of "init_worker_by_lua". Cosockets are currently disabled in "init_worker_by_lua". So we have to use workaround solution like use a zero-delay timer.
Other than "resty" utility, can we run the client and server programs using any other way i.e., ngnix like in the example https://openresty.org/en/getting-started.html.
Something like "nginx -p `pwd`/ -c conf/nginx.conf" in the example. Basically I am trying to find simple way to execute the programs.
Could you please let me know.
Thanks, Rajasekhar.
Hi, @rainingmaster, Thanks a lot for your reply.
OK, I understood that, "resty" utility is running under context of "init_worker_by_lua". Cosockets are currently disabled in "init_worker_by_lua". So we have to use workaround solution like use a zero-delay timer. Other than "resty" utility, can we run the client and server programs using any other way i.e., ngnix like in the example https://openresty.org/en/getting-started.html. Something like "nginx -p `pwd`/ -c conf/nginx.conf" in the example. Basically I am trying to find simple way to execute the programs. Could you please let me know.
Thanks, Rajasekhar.
Hi, @Rajasekhar-topgear , I think I didn't catch you, do you mean you want to know instead of resty
, how to run a Openresty with lua code?
Hi @rainingmaster,
1) Yes, instead of resty, how to run Openresty with lua code ?
2) I tried with zero-delay timer as you suggested. I am able to compile the client code but I am getting same error with the server code. PFA the client code and server code.
[root@IDA openresty-1.15.8.3]# resty ida_server.lua
Starting Server
2020/06/26 04:05:15 [error] 9174#0: *3 lua entry thread aborted: runtime error: /usr/local/openresty/lualib/resty/websocket/server.lua:36: API disabled in the current context
stack traceback:
coroutine 0:
[C]: in function 'error'
/usr/local/openresty/lualib/resty/core/misc.lua:166: in function '__index'
/usr/local/openresty/lualib/resty/websocket/server.lua:36: in function 'new'
ida_server.lua:9: in function
[root@IDA openresty-1.15.8.3]# resty ida_client.lua Starting Client failed to receive the frame: bad RSV1, RSV2, or RSV3 bits [root@IDA openresty-1.15.8.3]#
Hi,
Errors::
[root@IDA openresty-1.15.8.3]# resty ida_client.lua ERROR: ida_client.lua:3: API disabled in the current context stack traceback: /usr/local/openresty/lualib/resty/core/var.lua:73: in function '__index' ida_client.lua:3: in function 'file_gen' init_worker_by_lua:45: in function
[C]: in function 'xpcall'
init_worker_by_lua:52: in function
[root@IDA openresty-1.15.8.3]#
[root@IDA openresty-1.15.8.3]#
[root@IDA openresty-1.15.8.3]#
[root@IDA openresty-1.15.8.3]# resty ida_server.lua
ERROR: /usr/local/openresty/lualib/resty/websocket/server.lua:36: API disabled in the current context
stack traceback:
/usr/local/openresty/lualib/resty/core/misc.lua:166: in function '__index'
/usr/local/openresty/lualib/resty/websocket/server.lua:36: in function 'new'
ida_server.lua:3: in function 'file_gen'
init_worker_by_lua:45: in function
[C]: in function 'xpcall'
init_worker_by_lua:52: in function
[root@IDA openresty-1.15.8.3]#
Thanks, Rajasekhar
ida_client.txt ida_server.txt