Methods
(async) clearLog()
Example
let netmon = await instance.newNetworkMonitor();
netmon.clearLog();
disconnect()
- Description:
Disconnect an network monitor connection. This is usually only required if a new network monitor connection has been created and is no longer needed
- Source:
Example
netmon.disconnect();
(async) handleMessage(handler)
Example
let netmon = await instance.newNetworkMonitor();
netmon.handleMessage((message) => {
let host = message.request.headers.find(entry => entry.key === 'Host');
console.log(message.response.status, message.request.method, message.response.body.size, host.value);
});
Parameters:
Name | Type | Description |
---|---|---|
handler |
NetworkMonitor~newEntryCallback | the callback for captured entry |
(async) isEnabled() → {boolean}
Example
let enabled = await netmon.isEnabled();
if (enabled) {
console.log("enabled");
} else {
console.log("disabled");
}
Returns:
- Type
- boolean
(async) start(options)
Example
let netmon = await instance.newNetworkMonitor();
netmon.start({ truncatePcap: true });
Parameters:
Name | Type | Description |
---|---|---|
options |
StartOptions |
(async) stop()
Example
let netmon = await instance.newNetworkMonitor();
netmon.stop();
Type Definitions
newEntryCallback(entry)
- Description:
A callback for file upload progress messages. Can be passed to NetworkMonitor#handleMessage
- Source:
Example
let netmon = await instance.newNetworkMonitor();
netmon.handleMessage((message) => {
let host = message.request.headers.find(entry => entry.key === 'Host');
console.log(message.response.status, message.request.method, message.response.body.size, host.value);
});
Parameters:
Name | Type | Description |
---|---|---|
entry |
NetmonEntry | NetmonEntry object. |