interface ServerHttp2Session
extends Http2Session
Usage in Deno
```typescript import { type ServerHttp2Session } from "node:node__http2.d.ts"; ```> [!WARNING] Deno compatibility
> All methods are non-functional stubs.
Http1Request extends IncomingMessage = IncomingMessage
Http1Response extends ServerResponse = ServerResponse
Http2Request extends Http2ServerRequest = Http2ServerRequest
Http2Response extends Http2ServerResponse = Http2ServerResponse
altsvc(alt: string,originOrStream: ,): void
Submits an `ALTSVC` frame (as defined by [RFC 7838](https://tools.ietf.org/html/rfc7838)) to the connected client.
```js
import http2 from 'node:http2';
const server = http2.createServer();
server.on('session', (session) => {
// Set altsvc for origin https://example.org:80
session.altsvc('h2=":8000"', 'https://example.org:80');
});
server.on('stream', (stream) => {
// Set altsvc for a specific stream
stream.session.altsvc('h2=":8000"', stream.id);
});
```
Sending an `ALTSVC` frame with a specific stream ID indicates that the alternate
service is associated with the origin of the given `Http2Stream`.
The `alt` and origin string _must_ contain only ASCII bytes and are
strictly interpreted as a sequence of ASCII bytes. The special value `'clear'`may be passed to clear any previously set alternative service for a given
domain.
When a string is passed for the `originOrStream` argument, it will be parsed as
a URL and the origin will be derived. For instance, the origin for the
HTTP URL `'https://example.org/foo/bar'` is the ASCII string`'https://example.org'`. An error will be thrown if either the given string
cannot be parsed as a URL or if a valid origin cannot be derived.
A `URL` object, or any object with an `origin` property, may be passed as`originOrStream`, in which case the value of the `origin` property will be
used. The value of the `origin` property _must_ be a properly serialized
ASCII origin.
origin(...origins: Array<string
| url.URL
| { origin: string; }>): void
Submits an `ORIGIN` frame (as defined by [RFC 8336](https://tools.ietf.org/html/rfc8336)) to the connected client
to advertise the set of origins for which the server is capable of providing
authoritative responses.
```js
import http2 from 'node:http2';
const options = getSecureOptionsSomehow();
const server = http2.createSecureServer(options);
server.on('stream', (stream) => {
stream.respond();
stream.end('ok');
});
server.on('session', (session) => {
session.origin('https://example.com', 'https://example.org');
});
```
When a string is passed as an `origin`, it will be parsed as a URL and the
origin will be derived. For instance, the origin for the HTTP URL `'https://example.org/foo/bar'` is the ASCII string` 'https://example.org'`. An error will be thrown if either the given
string
cannot be parsed as a URL or if a valid origin cannot be derived.
A `URL` object, or any object with an `origin` property, may be passed as
an `origin`, in which case the value of the `origin` property will be
used. The value of the `origin` property _must_ be a properly serialized
ASCII origin.
Alternatively, the `origins` option may be used when creating a new HTTP/2
server using the `http2.createSecureServer()` method:
```js
import http2 from 'node:http2';
const options = getSecureOptionsSomehow();
options.origins = ['https://example.com', 'https://example.org'];
const server = http2.createSecureServer(options);
server.on('stream', (stream) => {
stream.respond();
stream.end('ok');
});
```
addListener(event: "connect",listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,socket: net.Socket | tls.TLSSocket,) => void,): this
addListener(event: "stream",listener: () => void,): this
addListener(event: string | symbol,listener: (...args: any[]) => void,): this
emit(event: "connect",session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,socket: net.Socket | tls.TLSSocket,): boolean
emit(): boolean
emit(event: string | symbol,...args: any[],): boolean
on(event: "connect",listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,socket: net.Socket | tls.TLSSocket,) => void,): this
on(event: "stream",listener: () => void,): this
on(event: string | symbol,listener: (...args: any[]) => void,): this
once(event: "connect",listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,socket: net.Socket | tls.TLSSocket,) => void,): this
once(event: "stream",listener: () => void,): this
once(event: string | symbol,listener: (...args: any[]) => void,): this
prependListener(event: "connect",listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,socket: net.Socket | tls.TLSSocket,) => void,): this
prependListener(event: "stream",listener: () => void,): this
prependListener(event: string | symbol,listener: (...args: any[]) => void,): this
prependOnceListener(event: "connect",listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,socket: net.Socket | tls.TLSSocket,) => void,): this
prependOnceListener(event: "stream",listener: () => void,): this
prependOnceListener(event: string | symbol,listener: (...args: any[]) => void,): this