'newSession' 事件


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

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

  • sessionId <Buffer> TLS 会话标识符
  • sessionData <Buffer> TLS 会话数据
  • callback <Function> 回调函数不带参数,必须调用这些参数才能通过安全连接发送或接收数据。

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

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> The TLS session identifier
  • sessionData <Buffer> The TLS session data
  • callback <Function> A callback function taking no arguments that must be invoked in order for data to be sent or received over the secure connection.

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