Hello!
On Thu, Jul 3, 2014 at 2:01 AM, Lionel Duboeuf wrote:
> I have a project where my server communicate with a tcp-ip socket
> I'm using co-socket api thanks to resty.mysql resty.redis great examples.
> Server side implemenation works with sessions, so that if i want to
> communicate with server i have to obtain a session. Note that session stick
> with the tcp-id socket.
> Now for the next http requests , i would like to be able to reuse a socket
> from the pool and use the apropriate session_id stored somewhere in the
> code.
Well, you can just use the session ID to construct your own connection
pool name (the default pool name is "<host>:<port>" or
"<unix-socket-path" if not specified). To do that, just specify the
"pool" option for the connect() method.
Please check out the official documentation for the cosocket connect()
method for more details on the optional "pool" option:
https://github.com/openresty/lua-nginx-module#tcpsockconnect
Best regards,
-agentzh