openresty / lua-resty-websocket

WebSocket support for the ngx_lua module (and OpenResty)
503 stars 106 forks source link

websocket client example #40

Open gitdhar opened 5 years ago

gitdhar commented 5 years ago

Using the websocket client (from sample code in the README), I get this error below: " ./openresty/lualib/resty/websocket/protocol.lua:21: attempt to index global 'ngx' (a nil value) "

I did set the package path as required. package.path = package.path .. ";./openresty/?.lua

Is there a working sample for websocket client?

agentzh commented 5 years ago

@gitdhar Please provide a minimal and self-contained example that can reproduce this. The ngx global variable should always be there in the context of OpenResty (or ngx_lua). There must be something very wrong in your OpenResty setup.