-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Description
Hi, apologize if its in the docs. I would like to create a link preview rpc API so that client can send a URL and get the title, desc, etc. Should I call devtool.New inside the RPC handler or only once when the service is initialized? How many connections to the devtool can be managed at a time ? I'm planning to use the docker as described here: https://stackoverflow.com/questions/59110235/how-to-run-chromedp-in-docker
I am confused if 10k users call my RPC, that means 10k connections to the devtool and how is it going to be handled by the chromedriver
thank you
ctx2, cancel := context.WithTimeout(context.Background(), 100*time.Second)
defer cancel()
// Use the DevTools HTTP/JSON API to manage targets (e.g. pages, webworkers).
devt := devtool.New("http://127.0.0.1:9222")
pt, err := devt.Get(ctx2, devtool.Page)
if err != nil {
pt, err = devt.Create(ctx2)
if err != nil {
return nil, err
}
}
// Initiate a new RPC connection to the Chrome DevTools Protocol target.
conn, err := rpcc.DialContext(ctx2, pt.WebSocketDebuggerURL)
if err != nil {
return nil, err
}
defer conn.Close() // Leaving connections open will leak memory.
c := cdp.NewClient(conn)
Metadata
Metadata
Assignees
Labels
No labels