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
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
Link copied to clipboard
Link copied to clipboard
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
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
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
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
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
fun addListener(type: EventType, listener: EventListener)

Alias for emitter.on(eventName, listener).

abstract fun addListener(event: Symbol, listener: Function<Unit>)
abstract fun addListener(event: String, listener: Function<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
fun emit(type: EventType, vararg args: Any?): Boolean

Synchronously calls each of the listeners registered for the event named eventName, in the order they were registered, passing the supplied arguments to each.

abstract fun emit(event: Symbol, vararg args: Any?): Boolean
abstract fun emit(event: String, vararg args: Any?): 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
fun listenerCount(type: EventType, listener: EventListener = definedExternally): Double

Returns the number of listeners listening for the event named eventName. If listener is provided, it will return how many times the listener is found in the list of the listeners of the event.

Link copied to clipboard

Returns a copy of the array of listeners for the event named eventName.

Link copied to clipboard
fun off(type: EventType, listener: EventListener)

Alias for emitter.removeListener().

Link copied to clipboard
fun on(type: EventType, listener: EventListener)

Adds the listener function to the end of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventName and listener will result in the listener being added, and called, multiple times.

abstract fun on(event: Symbol, listener: Function<Unit>)
abstract fun on(event: String, listener: Function<Unit>)
Link copied to clipboard
fun once(type: EventType, listener: EventListener)

Adds a one-time listener function for the event named eventName. The next time eventName is triggered, this listener is removed and then invoked.

abstract fun once(event: Symbol, listener: Function<Unit>)
abstract fun once(event: String, listener: Function<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

Adds the listener function to the beginning of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventName and listener will result in the listener being added, and called, multiple times.

abstract fun prependListener(event: Symbol, listener: Function<Unit>)
abstract fun prependListener(event: String, listener: Function<Unit>)
Link copied to clipboard

Adds a one-timelistener function for the event named eventName to the beginning of the listeners array. The next time eventName is triggered, this listener is removed, and then invoked.

abstract fun prependOnceListener(event: Symbol, listener: Function<Unit>)
abstract fun prependOnceListener(event: String, listener: Function<Unit>)
Link copied to clipboard

Returns a copy of the array of listeners for the event named eventName, including any wrappers (such as those created by .once()).

Link copied to clipboard
abstract fun ref()

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

Link copied to clipboard
fun removeAllListeners(type: EventType = definedExternally)

Removes all listeners, or those of the specified eventName.

Link copied to clipboard
fun removeListener(type: EventType, listener: EventListener)

Removes the specified listener from the listener array for the event named eventName.

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.