事件:'origin'
【Event: 'origin'】
origins字符串数组
每当客户端接收到 ORIGIN 帧时,就会触发 'origin' 事件。该事件会携带一个 origin 字符串数组。http2session.originSet 将会更新以包含接收到的原点。
【The 'origin' event is emitted whenever an ORIGIN frame is received by
the client. The event is emitted with an array of origin strings. The
http2session.originSet will be updated to include the received
origins.】
import { connect } from 'node:http2';
const client = connect('https://example.org');
client.on('origin', (origins) => {
for (let n = 0; n < origins.length; n++)
console.log(origins[n]);
});const http2 = require('node:http2');
const client = http2.connect('https://example.org');
client.on('origin', (origins) => {
for (let n = 0; n < origins.length; n++)
console.log(origins[n]);
});只有在使用安全的 TLS 连接时才会触发 'origin' 事件。
【The 'origin' event is only emitted when using a secure TLS connection.】