chrome-devtools-kotlin / org.hildan.chrome.devtools.protocol / ChromeDPClient / webSocket

webSocket

suspend fun webSocket(): ChromeBrowserSession

Opens a web socket connection to interact with the browser target (root session, without session ID).

The returned ChromeBrowserSession only provides a limited subset of the possible operations, because it is attached to the default browser target, not a page target. To attach to a specific target using the same underlying web socket connection, call ChromeBrowserSession.attachToPage or ChromeBrowserSession.attachToNewPage.

Note that you're responsible for closing the web socket by calling ChromeBrowserSession.close, or indirectly by calling (use()). Note that calling close() or use() on a derived ChromePageSession doesn't close the underlying web socket connection.