Skip to content

Commit

Permalink
doc: add TLS session resumption example
Browse files Browse the repository at this point in the history
Using TLS session resumption correctly is not obvious. This added
example code should help new users understand how to use it correctly.

Related issue: #3132
PR-URL: #3147
Reviewed-By: Fedor Indutny <[email protected]>
  • Loading branch information
silverwind authored and jasnell committed Oct 8, 2015
1 parent b3c5ad1 commit 28aac7f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions doc/api/tls.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,16 @@ perform lookup in external storage using given `sessionId`, and invoke
NOTE: adding this event listener will have an effect only on connections
established after addition of event listener.

Here's an example for using TLS session resumption:

var tlsSessionStore = {};
server.on('newSession', function(id, data, cb) {
tlsSessionStore[id.toString('hex')] = data;
cb();
});
server.on('resumeSession', function(id, cb) {
cb(null, tlsSessionStore[id.toString('hex')] || null);
});

### Event: 'OCSPRequest'

Expand Down

0 comments on commit 28aac7f

Please sign in to comment.