pl.wendigo.chrome.protocol / ChromeDebuggerConnection

ChromeDebuggerConnection

class ChromeDebuggerConnection (source)

ChromeDebuggerConnection represents connection to chrome's debugger via DevTools Protocol.

It depends on DebuggerFramesStream which is responsible for providing stream of protocol frames (both events and responses) and allows for sending requests.

FrameMapper is responsible for decoding/encoding objects to/from JSON frames which DevTools Protocol can understand.

See Also

DebuggerFramesStream

FrameMapper

Constructors

<init>

ChromeDebuggerConnection(frames: DebuggerFramesStream, eventMapper: EventMapper = EventMapper(), sessionId: SessionID? = null)

ChromeDebuggerConnection represents connection to chrome's debugger via DevTools Protocol.

Functions

addEventMapping

fun addEventMapping(name: String, clazz: Class<out Event>): Unit

Registers event name to class mappings.

allEvents

fun allEvents(): Flowable<Event>

Captures all events as generated by remote debugger

cloneForSessionId

fun cloneForSessionId(sessionID: SessionID): ChromeDebuggerConnection

Reuse existing debugger connection but for new sessionID sharing underlying websocket connection.

close

fun close(): Unit

Closes connection to remote debugger.

events

fun <T : Event> events(eventName: String, outClazz: Class<T>): Flowable<T>

Captures events by given name and casts received messages to specified class.

request

fun <T> request(methodName: String, requestParams: Any?, responseClazz: Class<T>): Single<T>

Sends request and captures response from the stream.

Companion Object Functions

open

fun open(websocketUri: String, framesBufferSize: Int = 128): ChromeDebuggerConnection

Creates new ChromeDebuggerConnection session for given websocket uri and frames buffer size.