Created
March 22, 2016 11:30
-
-
Save fabe/887b7801ce9f10603b62 to your computer and use it in GitHub Desktop.
Chrome plugin to send every network request to a server via socket.io.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "plugin", | |
"description": "plugin description.", | |
"devtools_page": "plugin.html", | |
"permissions": [ | |
"http://*/*", | |
"https://*/*" | |
], | |
"manifest_version": 1, | |
"version": "1" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="https://cdn.socket.io/socket.io-1.4.5.js"></script> | |
<script src="plugin.js"></script> | |
</head> | |
<body></body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var socket = io.connect('http://localhost:8888'); // your url for the request | |
chrome.devtools.network.onRequestFinished.addListener(function(request) { | |
var data = {}; | |
// get request data | |
data.url = request.request.url; | |
data.size = request.response.content.size; | |
data.type = request.response.content.mimeType; | |
data.time = request.time; | |
data.start = request.startedDateTime; | |
// send data to server | |
socket.emit('data', data); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment