Http2Session

Properties

Link copied to clipboard
abstract val alpnProtocol: String?

Value will be undefined if the Http2Session is not yet connected to a socket, h2c if the Http2Session is not connected to a TLSSocket, or will return the value of the connected TLSSocket's own alpnProtocol property.

Link copied to clipboard
abstract val closed: Boolean

Will be true if this Http2Session instance has been closed, otherwise false.

Link copied to clipboard
abstract val connecting: Boolean

Will be true if this Http2Session instance is still connecting, will be set to false before emitting connect event and/or calling the http2.connect callback.

Link copied to clipboard
abstract val destroyed: Boolean

Will be true if this Http2Session instance has been destroyed and must no longer be used, otherwise false.

Link copied to clipboard
abstract val encrypted: Boolean?

Value is undefined if the Http2Session session socket has not yet been connected, true if the Http2Session is connected with a TLSSocket, and false if the Http2Session is connected to any other kind of socket or stream.

Link copied to clipboard
abstract val localSettings: Settings

A prototype-less object describing the current local settings of this Http2Session. The local settings are local to thisHttp2Session instance.

Link copied to clipboard

If the Http2Session is connected to a TLSSocket, the originSet property will return an Array of origins for which the Http2Session may be considered authoritative.

Link copied to clipboard

Indicates whether the Http2Session is currently waiting for acknowledgment of a sent SETTINGS frame. Will be true after calling the http2session.settings() method. Will be false once all sent SETTINGS frames have been acknowledged.

Link copied to clipboard
abstract val remoteSettings: Settings

A prototype-less object describing the current remote settings of thisHttp2Session. The remote settings are set by the connected HTTP/2 peer.

Link copied to clipboard
abstract val socket: Any

Returns a Proxy object that acts as a net.Socket (or tls.TLSSocket) but limits available methods to ones safe to use with HTTP/2.

Link copied to clipboard
abstract val state: SessionState

Provides miscellaneous information about the current state of theHttp2Session.

Link copied to clipboard
abstract val type: Double

The http2session.type will be equal to http2.constants.NGHTTP2_SESSION_SERVER if this Http2Session instance is a server, and http2.constants.NGHTTP2_SESSION_CLIENT if the instance is a client.

Functions

Link copied to clipboard
abstract fun addListener(event: Symbol, listener: Function<Unit>)
abstract fun addListener(event: String, listener: Function<Unit>)
abstract fun addListener(event: Http2SessionEvent.CLOSE, listener: () -> Unit)
abstract fun addListener(event: Http2SessionEvent.ERROR, listener: (JsError) -> Unit)
abstract fun addListener(event: Http2SessionEvent.FRAMEERROR, listener: (frameType: Double, errorCode: Double, streamID: Double) -> Unit)
abstract fun addListener(event: Http2SessionEvent.GOAWAY, listener: (errorCode: Double, lastStreamID: Double, opaqueData: Buffer?) -> Unit)
abstract fun addListener(event: Http2SessionEvent.LOCALSETTINGS, listener: (settings: Settings) -> Unit)
abstract fun addListener(event: Http2SessionEvent.PING, listener: () -> Unit)
abstract fun addListener(event: Http2SessionEvent.REMOTESETTINGS, listener: (settings: Settings) -> Unit)
abstract fun addListener(event: Http2SessionEvent.TIMEOUT, listener: () -> Unit)
Link copied to clipboard
abstract fun close(callback: () -> Unit = definedExternally)

Gracefully closes the Http2Session, allowing any existing streams to complete on their own and preventing new Http2Stream instances from being created. Once closed, http2session.destroy()might be called if there are no open Http2Stream instances.

Link copied to clipboard
abstract fun destroy(error: JsError = definedExternally, code: Number = definedExternally)

Immediately terminates the Http2Session and the associated net.Socket or tls.TLSSocket.

Link copied to clipboard
abstract fun emit(event: Http2SessionEvent.CLOSE): Boolean
abstract fun emit(event: Http2SessionEvent.PING): Boolean
abstract fun emit(event: Http2SessionEvent.TIMEOUT): Boolean
abstract fun emit(event: Symbol, vararg args: Any?): Boolean
abstract fun emit(event: String, vararg args: Any?): Boolean
abstract fun emit(event: Http2SessionEvent.ERROR, err: JsError): Boolean
abstract fun emit(event: Http2SessionEvent.LOCALSETTINGS, settings: Settings): Boolean
abstract fun emit(event: Http2SessionEvent.REMOTESETTINGS, settings: Settings): Boolean
abstract fun emit(event: Http2SessionEvent.FRAMEERROR, frameType: Number, errorCode: Number, streamID: Number): Boolean
abstract fun emit(event: Http2SessionEvent.GOAWAY, errorCode: Number, lastStreamID: Number, opaqueData: Buffer = definedExternally): Boolean
Link copied to clipboard

Returns an array listing the events for which the emitter has registered listeners. The values in the array are strings or Symbols.

Link copied to clipboard

Returns the current max listener value for the EventEmitter which is either set by emitter.setMaxListeners(n) or defaults to {@link defaultMaxListeners}.

Link copied to clipboard
abstract fun goaway(code: Number = definedExternally, lastStreamID: Number = definedExternally, opaqueData: ArrayBufferView = definedExternally)

Transmits a GOAWAY frame to the connected peer without shutting down theHttp2Session.

Link copied to clipboard
abstract fun on(event: Symbol, listener: Function<Unit>)
abstract fun on(event: String, listener: Function<Unit>)
abstract fun on(event: Http2SessionEvent.CLOSE, listener: () -> Unit)
abstract fun on(event: Http2SessionEvent.ERROR, listener: (JsError) -> Unit)
abstract fun on(event: Http2SessionEvent.FRAMEERROR, listener: (frameType: Double, errorCode: Double, streamID: Double) -> Unit)
abstract fun on(event: Http2SessionEvent.GOAWAY, listener: (errorCode: Double, lastStreamID: Double, opaqueData: Buffer?) -> Unit)
abstract fun on(event: Http2SessionEvent.LOCALSETTINGS, listener: (settings: Settings) -> Unit)
abstract fun on(event: Http2SessionEvent.PING, listener: () -> Unit)
abstract fun on(event: Http2SessionEvent.REMOTESETTINGS, listener: (settings: Settings) -> Unit)
abstract fun on(event: Http2SessionEvent.TIMEOUT, listener: () -> Unit)
Link copied to clipboard
abstract fun once(event: Symbol, listener: Function<Unit>)
abstract fun once(event: String, listener: Function<Unit>)
abstract fun once(event: Http2SessionEvent.CLOSE, listener: () -> Unit)
abstract fun once(event: Http2SessionEvent.ERROR, listener: (JsError) -> Unit)
abstract fun once(event: Http2SessionEvent.FRAMEERROR, listener: (frameType: Double, errorCode: Double, streamID: Double) -> Unit)
abstract fun once(event: Http2SessionEvent.GOAWAY, listener: (errorCode: Double, lastStreamID: Double, opaqueData: Buffer?) -> Unit)
abstract fun once(event: Http2SessionEvent.LOCALSETTINGS, listener: (settings: Settings) -> Unit)
abstract fun once(event: Http2SessionEvent.PING, listener: () -> Unit)
abstract fun once(event: Http2SessionEvent.REMOTESETTINGS, listener: (settings: Settings) -> Unit)
abstract fun once(event: Http2SessionEvent.TIMEOUT, listener: () -> Unit)
Link copied to clipboard
abstract fun ping(callback: (JsError?, duration: Double, payload: Buffer) -> Unit): Boolean

Sends a PING frame to the connected HTTP/2 peer. A callback function must be provided. The method will return true if the PING was sent, false otherwise.

abstract fun ping(payload: ArrayBufferView, callback: (JsError?, duration: Double, payload: Buffer) -> Unit): Boolean
Link copied to clipboard
abstract fun prependListener(event: Symbol, listener: Function<Unit>)
abstract fun prependListener(event: String, listener: Function<Unit>)
abstract fun prependListener(event: Http2SessionEvent.CLOSE, listener: () -> Unit)
abstract fun prependListener(event: Http2SessionEvent.ERROR, listener: (JsError) -> Unit)
abstract fun prependListener(event: Http2SessionEvent.FRAMEERROR, listener: (frameType: Double, errorCode: Double, streamID: Double) -> Unit)
abstract fun prependListener(event: Http2SessionEvent.GOAWAY, listener: (errorCode: Double, lastStreamID: Double, opaqueData: Buffer?) -> Unit)
abstract fun prependListener(event: Http2SessionEvent.LOCALSETTINGS, listener: (settings: Settings) -> Unit)
abstract fun prependListener(event: Http2SessionEvent.PING, listener: () -> Unit)
abstract fun prependListener(event: Http2SessionEvent.REMOTESETTINGS, listener: (settings: Settings) -> Unit)
abstract fun prependListener(event: Http2SessionEvent.TIMEOUT, listener: () -> Unit)
Link copied to clipboard
abstract fun prependOnceListener(event: Symbol, listener: Function<Unit>)
abstract fun prependOnceListener(event: String, listener: Function<Unit>)
abstract fun prependOnceListener(event: Http2SessionEvent.CLOSE, listener: () -> Unit)
abstract fun prependOnceListener(event: Http2SessionEvent.ERROR, listener: (JsError) -> Unit)
abstract fun prependOnceListener(event: Http2SessionEvent.FRAMEERROR, listener: (frameType: Double, errorCode: Double, streamID: Double) -> Unit)
abstract fun prependOnceListener(event: Http2SessionEvent.GOAWAY, listener: (errorCode: Double, lastStreamID: Double, opaqueData: Buffer?) -> Unit)
abstract fun prependOnceListener(event: Http2SessionEvent.LOCALSETTINGS, listener: (settings: Settings) -> Unit)
abstract fun prependOnceListener(event: Http2SessionEvent.PING, listener: () -> Unit)
abstract fun prependOnceListener(event: Http2SessionEvent.REMOTESETTINGS, listener: (settings: Settings) -> Unit)
abstract fun prependOnceListener(event: Http2SessionEvent.TIMEOUT, listener: () -> Unit)
Link copied to clipboard
abstract fun ref()

Calls ref() on this Http2Session instance's underlying net.Socket.

Link copied to clipboard
abstract fun setLocalWindowSize(windowSize: Number)

Sets the local endpoint's window size. The windowSize is the total window size to set, not the delta.

Link copied to clipboard

By default EventEmitters will print a warning if more than 10 listeners are added for a particular event. This is a useful default that helps finding memory leaks. The emitter.setMaxListeners() method allows the limit to be modified for this specific EventEmitter instance. The value can be set to Infinity (or 0) to indicate an unlimited number of listeners.

Link copied to clipboard
abstract fun setTimeout(msecs: Number, callback: () -> Unit = definedExternally)

Used to set a callback function that is called when there is no activity on the Http2Session after msecs milliseconds. The given callback is registered as a listener on the 'timeout' event.

Link copied to clipboard
abstract fun settings(settings: Settings, callback: (JsError?, settings: Settings, duration: Double) -> Unit = definedExternally)

Updates the current local settings for this Http2Session and sends a new SETTINGS frame to the connected HTTP/2 peer.

Link copied to clipboard
abstract fun unref()

Calls unref() on this Http2Sessioninstance's underlying net.Socket.