Get started Debug Images Video/audio Customization Reference

Debug

Console output

Greta supports extra debugging messages by setting the option debug to true. This option will allow you to see the peer-to-peer traffic as well as the routing algorithm decisions in the console in real-time.

<script>
    GretaOptions = {
      debug: true
    }
</script>
Found 234 peers
This log tells you how many possible peers Greta found.
Connecting to peer
Marks the start of opening a new connection.
Connected to peer
Connection is established and ready for data.
Disconnected from peer
Marks the closing of a connection.
Loading https://url.co/img.jpg from server
Loading https://url.co/img.jpg from cache
Loading https://url.co/img.jpg from peer
When Greta starts loading something for you there'll be a log with the url and the method(server/cache/p2p).
Server loaded https://url.co/img.jpg in 910ms, speed: 197954 kbps, size: 2 MB
Cache loaded https://url.co/img.jpg in 910ms, speed: 197954 kbps, size: 2 MB
p2p loaded https://url.co/img.jpg in 430ms, speed: 32132 kbps, size: 2 MB
When a request succeeds this log will display: the url, method(server/cache/p2p), the speed, time and size of the request.
p2p sent: 2 MB
This log shows that you sent data to another peer in the network.
Failed loading https://url.co/img.jpg verify your CORS headers here https://greta.io/cors.html
This log explains something went wrong when loading.

Simulate peer-to-peer

Once debug is enabled, you can trigger a peer-to-peer network and watch the traffic with the Chrome DevTools. Open chrome-dev tools before visiting your page, then in a new incognito, open Chrome DevTools and then visit your site. You will now be able to view the logs about your network peers in your console.

<script>
    GretaOptions = {
      debug: true
    }
</script>
Connecting to peer
Connected to peer
p2p sent: 2 MB
p2p sent: 349 KB
p2p sent: 794 KB
Loading https://url.co/img.jpg from peer
p2p loaded https://url.co/img.jpg in 430ms, speed: 32132 kbps, size: 2 MB
  // 1. open chrome-dev tools
  // 2. go to your page
  // 3. open a new incognito window
  // 4. open chrome-dev tools
  // 5. go to the site
  // 6. look for following logs

  Connecting to peer
  Connected to peer
  p2p sent: <size>
  p2p loaded <url>, <time>, <speed>, <size>

Errors

Bummer! Please contact us at support@greta.io so we can immediately fix any errors.