事件:'newSession'


【Event: 'newSession'

'newSession' 事件在创建新的 TLS 会话时触发。这可以用于将会话存储在外部存储中。数据应提供给 'resumeSession' 回调。

【The 'newSession' event is emitted upon creation of a new TLS session. This may be used to store sessions in external storage. The data should be provided to the 'resumeSession' callback.】

监听器回调在调用时传入三个参数:

【The listener callback is passed three arguments when called:】

  • sessionId <Buffer> TLS 会话标识符
  • sessionData <Buffer> TLS 会话数据
  • callback <Function> 一个不接受任何参数的回调函数,必须调用它才能通过安全连接发送或接收数据。

监听此事件只会对在添加事件监听器之后建立的连接产生影响。

【Listening for this event will have an effect only on connections established after the addition of the event listener.】