You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: DOCUMENTATION.md
+6-9Lines changed: 6 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -82,7 +82,7 @@ Before using the CDP Logger Client, make sure you have the following:
82
82
83
83
-**ProtoBuf JS** – The library depends on `protobufjs` (included as an npm dependency). If you installed via npm and are using a bundler or Node, this will be installed automatically. If you are using direct script includes, include the `protobuf.min.js` as shown above.
84
84
85
-
-**CDP Logger API Compatibility** – As noted, the target CDP Logger should be running a version that supports the queries you need. Basic data queries work on older versions (3.0+), but features like tags and advanced event filtering require newer CDP releases (CDP 4.12 for tags support, etc.). If you’re running an older CDP version and some API calls fail or are not supported, consider upgrading CDP Studio or limiting to the supported features.
85
+
-**CDP Logger API Compatibility** – As noted, the target CDP Logger should be running a version that supports the queries you need. Basic data queries work on older versions (CDP 4.3+), but features like tags and advanced event filtering require newer CDP releases (CDP 4.12 for tags support, etc.). If you’re running an older CDP version and some API calls fail or are not supported, consider upgrading CDP Studio or limiting to the supported features.
86
86
87
87
## Setup and Configuration
88
88
@@ -149,7 +149,6 @@ A few notes on the above example:
149
149
You can also request historical **data points** for one or more signals using `client.requestDataPoints(names, startTimeSec, endTimeSec, numberOfPoints)`. For example:
150
150
151
151
```js
152
-
// Assume we got `limits` from requestLogLimits (which provides start and end of log):
153
152
constlimits=awaitclient.requestLogLimits();
154
153
conststart=limits.startS;
155
154
constend=limits.endS;
@@ -175,15 +174,15 @@ The above demonstrates retrieving 100 aggregated data points between the earlies
175
174
Finally, to retrieve **events**, you can use `client.requestEvents(query)` along with constructing a query object. You can also use `client.countEvents(query)` to just get the count. Here’s a brief Node example for events:
176
175
177
176
```js
178
-
constquery= {
177
+
constquery= {// Note: all query arguments are optional
// Assume events have a field "Text" and we want those containing "Overheat"
184
183
Text: ["Overheat*"] // '*' wildcard is the default option
185
184
},
186
-
timeRangeStart:Date.now()/1000-24*3600, //(optional) last 24 hours in seconds (if time filtering desired)
185
+
timeRangeStart:Date.now()/1000-24*3600, // last 24 hours in seconds (if time filtering desired)
187
186
limit:50, // max 50 events
188
187
offset:0, // start from the first match
189
188
flags:EventQueryFlags.NewestFirst// get newest events first
@@ -218,7 +217,7 @@ Using the client in a browser is similar, except you don’t need to polyfill We
218
217
219
218
<script>
220
219
// Once scripts are loaded, use the global cdplogger
221
-
constclient=newcdplogger.Client("ws://localhost:17000"); //connect to logger
220
+
constclient=newcdplogger.Client(window.location.hostname+":17000"); //Connect to logger
222
221
223
222
// Example: fetch API version
224
223
client.requestApiVersion().then(version=> {
@@ -238,11 +237,9 @@ As shown, the usage is very much the same as in Node. The `cdplogger.Client` cla
238
237
239
238
A few browser-specific notes:
240
239
241
-
-**Security:** If your CDP Logger is served over HTTPS (or you are accessing it from an HTTPS page), use `wss://` for the WebSocket URL to avoid mixed content issues. Ensure the CDP Logger is configured with TLS if needed. For local testing with `http://localhost` you can use `ws://` without issues.
242
-
243
240
-**CORS/WebSocket Policy:** WebSocket connections are not subject to the same-origin policy in the way XHR/Fetch are, but some environments might still require the server to accept the connection. The CDP Logger’s WebSocket server should accept connections from any origin by default. If you encounter issues connecting from a web page, check if any firewall or network configuration is blocking the websocket port.
244
241
245
-
-**Performance:** Retrieving a lot of data points or events in one go can be heavy for the browser. If you plan to visualize large data sets, consider using pagination (e.g., request events 100 at a time using `offset`) or downsampling data points via the `numberOfPoints` parameter. The library itself streams the data efficiently, but rendering thousands of points in the DOM can be slow, so plan accordingly.
242
+
-**Performance:** Retrieving a lot of data points or events in one go can be heavy for the browser. If you plan to visualize large data sets, consider using pagination (e.g., request events 100 at a time using `offset`) or downsampling data points via the `noOfDataPoints` parameter. The library itself streams the data efficiently, but rendering thousands of points in the DOM can be slow, so plan accordingly.
246
243
247
244
## How to Run Tests
248
245
@@ -293,4 +290,4 @@ This project is open-source software licensed under the **MIT License**. See the
293
290
294
291
---
295
292
296
-
*Thank you for using the JavaScript CDP Logger Client!* We hope this library makes it easier to integrate CDP Studio’s powerful logging capabilities into your own tools and applications. ([GitHub - CDPTechnologies/JavascriptCDPLoggerClient: A simple Javascript interface to communicate with CDP applications containing a CDPLogger component to retrieve historic data.](https://github.com/CDPTechnologies/JavascriptCDPLoggerClient#:~:text=A%20simple%20JavaScript%20interface%20for,com))
293
+
*Thank you for using the JavaScript CDP Logger Client!* We hope this library makes it easier to integrate CDP Studio’s powerful logging capabilities into your own tools and applications. ([GitHub - CDPTechnologies/JavascriptCDPLoggerClient](https://github.com/CDPTechnologies/JavascriptCDPLoggerClient#:~:text=A%20simple%20JavaScript%20interface%20for,com))
console.error("Error retrieving data points:", err);
167
+
});
168
+
}
134
169
});
135
170
</script>
136
171
</body>
137
172
</html>
138
173
```
139
174
140
-
*In the browser version, by including `client.js` (with the modifications described above), the client automatically uses the native WebSocket, the global protobuf definitions from `window.root`, and attaches the API to `window.cdplogger`.*
175
+
*In the browser version, we use `window.location.hostname` to connect to the same host as the web page, with the default logger port 17000.*
0 commit comments