gcd

Unofficial implementation of the Google Chrome Remote Debugger in Go

Github stars Tracking Chart

Go Report Card

Google Chrome Debugger (GCD)

This is primarly an auto-generated client library for communicating with a Google Chrome Browser over their remote client debugger protocol. Note that their documentation is partially incorrect and does not contain a lot of the API calls that are actually available.

Because I'm lazy and there are hundereds of different custom types and API methods, this library has been automatically generated using their protocol.json.

The gcdapigen program was created to generate types, event types and commands for gcd.

Changelog

See the CHANGELOG.

Dependencies

gcd requires the gcdapi and gcdmessage packages. gcdapi is the auto-generated API. gcdmessage is the glue between gcd and gcdapi so we can keep the packages clean.

The API

The API consists of of synchronous requests, asynchronous requests / events. Synchronous requests are handled by using non-buffered channels and methods can be called and will return once the value is available. Events are handled by subscribing the response method type and calling the API's "Enable()" such as:

    target, err := debugger.NewTab()
    if err != nil {
    	log.Fatalf("error getting new tab: %s\n", err)
	}
	console := target.Console

	target.Subscribe("Console.messageAdded", func(target *ChromeTarget, v []byte) {
		
		msg := &gcdapi.ConsoleMessageAddedEvent{}
		err := json.Unmarshal(v, msg)
		if err != nil {
			log.Fatalf("error unmarshalling event data: %v\n", err)
		}
		log.Printf("METHOD: %s\n", msg.Method)
		eventData := msg.Params.Message
		log.Printf("Got event: %s\n", eventData)
	})
	console.Enable()
	// recv events
	// console.Disable()

Usage

For a full list of api methods, types, event types & godocs: Documentation

Examples

See examples

Licensing

The MIT License (MIT)

Copyright (c) 2018 isaac dawson

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Main metrics

Overview
Name With Ownerwirepair/gcd
Primary LanguageGo
Program languageGo (Language Count: 3)
Platform
License:MIT License
所有者活动
Created At2014-07-27 06:11:19
Pushed At2024-10-16 04:05:44
Last Commit At2024-10-16 13:03:24
Release Count43
Last Release Namev2.3.5 (Posted on )
First Release Namev1.0.0 (Posted on 2018-10-04 14:16:40)
用户参与
Stargazers Count185
Watchers Count8
Fork Count31
Commits Count282
Has Issues Enabled
Issues Count16
Issue Open Count1
Pull Requests Count55
Pull Requests Open Count1
Pull Requests Close Count5
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private