Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 28aac7f

Browse filesBrowse files
silverwindjasnell
authored andcommitted
doc: add TLS session resumption example
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 <fedor.indutny@gmail.com>
1 parent b3c5ad1 commit 28aac7f
Copy full SHA for 28aac7f

File tree

Expand file treeCollapse file tree

1 file changed

+10
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-0
lines changed
Open diff view settings
Collapse file

‎doc/api/tls.markdown‎

Copy file name to clipboardExpand all lines: doc/api/tls.markdown
+10Lines changed: 10 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,16 @@ perform lookup in external storage using given `sessionId`, and invoke
603603
NOTE: adding this event listener will have an effect only on connections
604604
established after addition of event listener.
605605

606+
Here's an example for using TLS session resumption:
607+
608+
var tlsSessionStore = {};
609+
server.on('newSession', function(id, data, cb) {
610+
tlsSessionStore[id.toString('hex')] = data;
611+
cb();
612+
});
613+
server.on('resumeSession', function(id, cb) {
614+
cb(null, tlsSessionStore[id.toString('hex')] || null);
615+
});
606616

607617
### Event: 'OCSPRequest'
608618

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.