|
1 | | -# CDPLogger Client for JavaScript |
| 1 | +# CDP Logger Client |
2 | 2 |
|
3 | | -A simple JavaScript interface for communicating with CDP applications that include a CDPLogger component to retrieve historic data. |
4 | | -- For documentation on the JS logger client see [DOCUMENTATION.md](DOCUMENTATION.md). |
5 | | -- For a quickstart guide on how to set-up the npm project for either Node or Web see [QUICKSTART.md](QUICKSTART.md) |
6 | | -- For more information about CDP Studio see https://cdpstudio.com/. |
| 3 | +A JavaScript client for interacting with CDP Logger or LogServer via WebSocket. This client allows you to: |
| 4 | +- Connect to a CDP Logger or LogServer |
| 5 | +- Request logged nodes and their metadata |
| 6 | +- Retrieve data points for specific nodes |
| 7 | +- Query events from the logger |
| 8 | +- Get log limits and API version information |
7 | 9 |
|
8 | 10 | ## Installation |
9 | 11 |
|
10 | | -Clone the repository and install dependencies: |
11 | | - |
12 | 12 | ```bash |
13 | | -npm install |
| 13 | +npm install cdp-logger-client |
14 | 14 | ``` |
15 | 15 |
|
| 16 | +## Quick Start |
16 | 17 |
|
17 | | -## Running Tests |
18 | | - |
19 | | -To run the automatic tests with fake data, execute: |
| 18 | +For a quick introduction, see the [QUICKSTART.md](QUICKSTART.md) guide. |
20 | 19 |
|
21 | | -```bash |
22 | | -npm test |
23 | | -``` |
24 | | - |
25 | | -Note: these jest tests execute on every push and pull of the repo as well. |
26 | | - |
27 | | -To test the time sync functionality using simulated response: |
28 | | - |
29 | | -```bash |
30 | | -node test/testTimeSync.js |
31 | | -``` |
| 20 | +## Documentation |
32 | 21 |
|
| 22 | +For detailed documentation, see [DOCUMENTATION.md](DOCUMENTATION.md). |
33 | 23 |
|
34 | 24 | ## Usage |
35 | 25 |
|
36 | | -The value.js file contains a simple logger built for the CDP Studio example case. |
| 26 | +### Node.js |
37 | 27 |
|
38 | | -1. Set up and run the Logger in CDP Studio. |
39 | | -(Refer to Help → Framework - Data Logging → How to Setup Logging in Automation System) |
40 | | -https://cdpstudio.com/manual/cdp/cdplogger/cdplogger-configuration-example.html |
| 28 | +```javascript |
| 29 | +const cdplogger = require('cdp-logger-client'); |
| 30 | +global.WebSocket = require('ws'); |
41 | 31 |
|
42 | | -2. Run the value.js file from the command line: |
| 32 | +const client = new cdplogger.Client('127.0.0.1:17000'); |
43 | 33 |
|
44 | | -```bash |
45 | | -node examples/value.js |
| 34 | +// List logged nodes |
| 35 | +client.requestLoggedNodes().then(nodes => { |
| 36 | + console.log("Available nodes:", nodes); |
| 37 | +}); |
46 | 38 | ``` |
47 | 39 |
|
48 | | -For usage related to events run: |
49 | | - |
50 | | -```bash |
51 | | -node examples/event.js |
| 40 | +### Browser |
| 41 | + |
| 42 | +```html |
| 43 | +<script src="protobuf.min.js"></script> |
| 44 | +<script src="containerPb.js"></script> |
| 45 | +<script src="client.js"></script> |
| 46 | +<script> |
| 47 | + const client = new cdplogger.Client(window.location.hostname + ":17000"); |
| 48 | + |
| 49 | + client.requestLoggedNodes().then(nodes => { |
| 50 | + console.log("Available nodes:", nodes); |
| 51 | + }); |
| 52 | +</script> |
52 | 53 | ``` |
53 | 54 |
|
| 55 | +## License |
54 | 56 |
|
55 | | -## Contact |
56 | | - |
57 | | -Email: support@cdptech.com |
| 57 | +MIT |
0 commit comments