Event: 'resumeSession'
function (sessionId, callback) { }
Emitted when the client wants to resume the previous TLS session. The event listener may perform a lookup in external storage using the given sessionId
and invoke callback(null, sessionData)
once finished. If the session can't be resumed (i.e., doesn't exist in storage) one may call callback(null, null)
. Calling callback(err)
will terminate incoming connection and destroy the socket.
NOTE: adding this event listener will only have an effect on connections established after the addition of the event listener.
Here's an example for using TLS session resumption:
1 2 3 4 5 6 7 8 | var tlsSessionStore = {}; server.on( 'newSession' , (id, data, cb) => { tlsSessionStore[id.toString( 'hex' )] = data; cb(); }); server.on( 'resumeSession' , (id, cb) => { cb( null , tlsSessionStore[id.toString( 'hex' )] || null ); }); |
Please login to continue.