Home Reference Source
public class | since chrome-remote-interface-extra | source

CRIConnection

Extends:

chrome-remote-interface/lib/chrome~Chrome → CRIConnection

An exact replica of puppeteer's Connection class that simply re-uses the prior art that is the one and only chrome-remote-interface by cyrus-and

Static Method Summary

Static Public Methods
public static
public static

fromSession(session: CDPSession | Chrome | Object): CRIConnection | Chrome | Object

Constructor Summary

Public Constructor
public

constructor(options: CRIOptions, notifier: EventEmitter)

Member Summary

Public Members
public get

Get the actual event that is emitted when the connection has closed

public
Private Members
private
private

_crieCallbacks: function(value: *): void, reject

private
private

_ws: *

Method Summary

Public Methods
public

async createSession(targetInfo: Object): Promise<CDPSession>

public
public

send(method: string, params: Object): Promise<Object>

public

session(sessionId: string): CDPSession

public
Protected Methods
protected

_interopSend(method: string, params: Object, callback: *): *

Utility function for maintaining the original CRI API

Private Methods
private

This override really on exists to turn off perMessageDeflate when creating the web socket

private

_handleMessage(object: Object): *

A very simple override of the original _handleMessage function that adds the handling both the puppeteer API and the original CRI API (minus direct sends)

private
private

_rawSend(message: Object): number

In order to have CDP sessions and allow them to operate as they do in Puppeteer we need to provide them a special method for them to send their messages and this is it :)

private

_start(): *

Static Public Methods

public static async connect(options: CRIOptions): Promise<CRIConnection> source

Params:

NameTypeAttributeDescription
options CRIOptions
  • optional

public static fromSession(session: CDPSession | Chrome | Object): CRIConnection | Chrome | Object source

Params:

NameTypeAttributeDescription
session CDPSession | Chrome | Object

Return:

CRIConnection | Chrome | Object

Public Constructors

public constructor(options: CRIOptions, notifier: EventEmitter) source

Params:

NameTypeAttributeDescription
options CRIOptions
notifier EventEmitter

Public Members

public get $$disconnectEvent: string: * source

Get the actual event that is emitted when the connection has closed

Return:

string

public webSocketUrl: * source

Private Members

private _closed: boolean source

private _crieCallbacks: function(value: *): void, reject source

private _sessions: Map<string, CDPSession> source

private _ws: * source

Public Methods

public async createSession(targetInfo: Object): Promise<CDPSession> source

Params:

NameTypeAttributeDescription
targetInfo Object

Return:

Promise<CDPSession>

public dispose() source

public send(method: string, params: Object): Promise<Object> source

Params:

NameTypeAttributeDescription
method string

protocol method name

params Object
  • optional
  • default: {}
  • nullable: false

Optional method parameters

Return:

Promise<Object>

public session(sessionId: string): CDPSession source

Params:

NameTypeAttributeDescription
sessionId string

Return:

CDPSession (nullable: true)

public toString(): string source

Return:

string

Protected Methods

protected _interopSend(method: string, params: Object, callback: *): * source

Utility function for maintaining the original CRI API

Params:

NameTypeAttributeDescription
method string
params Object
  • optional
callback *
  • optional

Return:

*

Private Methods

private _connectToWebSocket(): Promise<*> source

This override really on exists to turn off perMessageDeflate when creating the web socket

Return:

Promise<*>

private _handleMessage(object: Object): * source

A very simple override of the original _handleMessage function that adds the handling both the puppeteer API and the original CRI API (minus direct sends)

Params:

NameTypeAttributeDescription
object Object

Return:

*

private _onClose() source

private _rawSend(message: Object): number source

In order to have CDP sessions and allow them to operate as they do in Puppeteer we need to provide them a special method for them to send their messages and this is it :)

Params:

NameTypeAttributeDescription
message Object

Return:

number

private _start(): * source

Return:

*