Persistent TCP Connection for SSL


#1

I’m trying to have a persistent tcp connection for sending data using SSL. This is what is present in log context in the plugin. However i’m seeing different tcp connection for each transaction seen at Kong. Can anyone help on how to make use of same tcp connection. i’ve tried to move the socket.tcp() part to top of plugin so that it executes first and setting timeout there itself but it works only for first transaction.

function CustomPluginHandler:log(conf)
CustomPluginHandler.super.log(self)

– TLS/SSL client parameters (omitted)
local params = {
mode = “client”,
protocol = “tlsv1”,
verify = “none”,
options = “all”,
}
local line

local conn = socket.tcp()
conn:settimeout(conf.timeout)
conn:connect(“www.google.com”, 443)

– TLS/SSL initialization
local ssl_init = ssl.wrap(conn, params)
ssl_init:dohandshake()

ssl_init:send(“GET / HTTP/1.1\n\n”)
line, err = ssl_init:receive()

Any help is much appreciated


#2

Can any one look and help on this? thanks for your time