{"id":15019170,"url":"https://github.com/rakusan2/frc-nt-client","last_synced_at":"2025-10-24T05:31:28.126Z","repository":{"id":50151705,"uuid":"83471526","full_name":"rakusan2/FRC-NT-Client","owner":"rakusan2","description":"WPI NetworkTables Client for Node","archived":false,"fork":false,"pushed_at":"2021-06-02T12:36:38.000Z","size":163,"stargazers_count":21,"open_issues_count":4,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-31T00:07:34.290Z","etag":null,"topics":["frc","javascript","networktables"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/wpilib-nt-client","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rakusan2.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-28T19:33:42.000Z","updated_at":"2023-12-12T15:09:35.000Z","dependencies_parsed_at":"2022-09-07T05:51:23.962Z","dependency_job_id":null,"html_url":"https://github.com/rakusan2/FRC-NT-Client","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rakusan2%2FFRC-NT-Client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rakusan2%2FFRC-NT-Client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rakusan2%2FFRC-NT-Client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rakusan2%2FFRC-NT-Client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rakusan2","download_url":"https://codeload.github.com/rakusan2/FRC-NT-Client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237918710,"owners_count":19387305,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["frc","javascript","networktables"],"created_at":"2024-09-24T19:53:06.201Z","updated_at":"2025-10-24T05:31:26.601Z","avatar_url":"https://github.com/rakusan2.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WPILIB Network Tables Client\nThis client uses version [3.0](https://github.com/wpilibsuite/ntcore/blob/master/doc/networktables3.adoc)\n of the **Network Tables Protocol**. With a failover to [2.0](https://github.com/wpilibsuite/ntcore/blob/master/doc/networktables2.adoc)\n\n## Installation\n```\nnpm install wpilib-nt-client\n```\n\n## Usage\n\n```js\n// Decleration\nconst ntClient = require('wpilib-nt-client');\n\nconst client = new ntClient.Client()\n\n// Connects the client to the server on team 3571's roborio\nclient.start((isConnected, err) =\u003e {\n    // Displays the error and the state of connection\n    console.log({ isConnected, err });\n}, 'roborio-3571.local');\n\n// Adds a listener to the client\nclient.addListener((key, val, type, id) =\u003e {\n    console.log({ key, val, type, id });\n})\n```\n## Constructor\n- `Client()`\n    - Standard Constructor\n- `Client(options)`\n    - **options** an object containing is **strictInput** with a boolean value\n        - **strictInput** Does not try to correct incorrect types\n\n## Properties\n- `.start((connected, err, is2_0) =\u003e any, address, port)`\n    - Connects the client to a specific address and port\n    - **connected** - True if the client has successfully completed its handshake\n    - **err** - Contains the error if one has occurred\n    - **is2_0** - True if the client had to failover to 2.0 of the Network Tables protocol\n    - **address** - The address of the Server. Defaults to loopback\n    - **port** - The port of the server\n- `.stop()`\n    - Tries to stop the client by sending a fin packet\n- `.destroy()`\n    - Closes the connection forcefully\n- `.setReconnectDelay(delay)`\n    - **delay** set the delay before trying to reconnect\n    - If the dellay is less than 20 than it wll not attempt reconnect\n- `.addListener((key, value, valueType, type, id, flags) =\u003e any, getCurrent)`\n    - Adds a callback to be called when a value has been added, updated, or deleted, and returns the Listener\n    - **key** - The Key for the Entry\n    - **value** - The value associated with the key\n    - **valueType** - The type of the value Possible Types are listed Bellow\n    - **type** - The type of the callback. Possible Types are: \"add\", \"update\", \"delete\", \"flagChange\"\n    - **id** - The ID of the Entry\n    - **flags** - The flags of the Entry\n    - **getCurrent** - immediatly callback if connected with known entries\n- `.removeListener(listener)`\n    - Removes the specified listener\n    - **listener** - The Listener returned from `.addListener()`\n- `.isConnected()`\n    - Returns true if the client is connected and has completed its handshake\n- `.uses2_0()`\n    - Returns true if the client has switched to using version 2.0 of the NetworkTables protocol\n- `.getKeyID(key)`\n    - Returns the ID of a key or All of the keys if **key** is left out\n- `.getEntry(id)`\n    - Returns an Entry identified with an ID\n- `.Assign(val, name, persist)`\n    - Sets a new Entry\n    - **val** - The Value being added\n    - **name** - The Key for the Entry\n    - **persist** - An optional boolean value of whether the value shoud stay on the server after a restart\n    - Can return an error if type is an RPC\n- `.Update(id, val)`\n    - **id** - The ID of the Entry to be updated\n    - **val** - The new Value\n    - Can Return an error if the Entry does not exist ot the value is of the wrong type\n- `Flag(id, persist)`\n    - Updates the persist flag\n    - **id** - The ID of the Entry to be updated\n    - **persist** - An optional boolean value of whether the value shoud stay on the server after a restart\n    - Can return an error if the Entry does not exist\n- `.Delete(id)`\n    - Deletes an Entry\n    - **id** - The ID of the entry being Deleted\n    - Can Return an error if the Entry does not exist\n- `.DeleteAll()`\n    - Deletes all of the Entries\n    - Returns an error if the type is the client is using 2.0\n- `.RPCExec(id, val, (result) =\u003e any)`\n    - Calls a Remote Procedure\n    - **id** - The ID of the procedure\n    - **val** - The Parameters of the Procedure\n    - **result** - The result of the call\n    - Can Return an error of parameter type does not corespond to the definition, the Entry is not an RPC, or the Entry does not Exist\n- `.write(buf)`\n    - Sends a Message dirrectly to the server\n    - DO NOT USE unless you know what you are doing\n\n## Types\n- valueType\n    - Boolean\n    - Number\n    - String\n    - Buffer\n    - BooleanArray\n    - NumberArray\n    - StringArray\n    - RPC\n- valueID\n    - 0x00 : \"Boolean\"\n    - 0x01 : \"Number\"\n    - 0x02 : \"String\"\n    - 0x03 : \"Buffer\"\n    - 0x10 : \"BooleanArray\"\n    - 0x11 : \"NumberArray\"\n    - 0x12 : \"StringArray\"\n    - 0x20 : \"RPC\"\n\n## In 2.0\n- Delete does not work\n- Flags do not exist\n- RPC does not exist\n\n## RPC Entry Definition\nRemote Procedure Call\n```js\nRPC:{\n    // The name of the Call\n    name,\n    // The parameters of the call\n    par:{\n        // The Id of the type of the parameter\n        typeId,\n        // The name of the Type of the parameter\n        typeName,\n        // Name of the Parameter\n        name,\n        // Default value for the parameter\n        default\n    }[],\n    // The format of the results\n    results:{\n        // The Id of the type of the result\n        typeId,\n        // The name of the Type of the result\n        typeName,\n        // The name of the result\n        name\n    }[]\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frakusan2%2Ffrc-nt-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frakusan2%2Ffrc-nt-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frakusan2%2Ffrc-nt-client/lists"}