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
  • Loading branch information
silverwind committed Oct 6, 2015
1 parent 7d66749 commit 3ea5a60
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 3ea5a60

Please sign in to comment.