Official openresty cannot support nats pool (set_keepalive) because of the existence of heartbeat with NATs server.
File src/ngx_http_lua_socket_tcp.c handled the heartbeat, thus maintaining the connection.
You need replace openresty-1.15.8.2/bundle/ngx_lua-0.10.15/src/ngx_http_lua_socket_tcp.c, and rebuild openresty.
lua-resty-nats is test under openresty-1.15.8.1/openresty-1.15.8.2.