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: Node.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
-
# Node & Viam's TypeScript SDK
1
+
# Node.js & Viam's TypeScript SDK
2
2
3
-
This document contains detailed instructions on including Viam in your Node project. For a runnable example, see the [examples directory](/examples/node/).
3
+
This document contains detailed instructions on including Viam in your Node.js project. For a runnable example, see the [examples directory](/examples/node/).
4
4
5
5
## Requirements
6
6
7
-
This document assumes you already have Nodeinstalled. If not, follow the [instructions](https://nodejs.org/en/learn/getting-started/how-to-install-nodejs) provided by Node.
7
+
This document assumes you already have Node.js >= version 20 installed. If not, follow the [instructions](https://nodejs.org/en/learn/getting-started/how-to-install-nodejs) provided by Node.js.
8
8
9
9
### Dependencies
10
10
@@ -19,25 +19,25 @@ You can use either Yarn or NPM to install the dependencies. This document will u
19
19
20
20
### Polyfills
21
21
22
-
Using the SDK with Node also requires the use of some polyfills. In your application's entrypoint (`main.ts`, `index.ts`, or something similar), you will need to register those polyfills:
22
+
Using the SDK with Node.js also requires the use of some polyfills. In your application's entrypoint (`main.ts`, `index.ts`, or something similar), you will need to register those polyfills:
23
23
24
24
```ts
25
25
// main.ts
26
26
27
-
importwrtc=require('node-datachannel/polyfill');
27
+
const wrtc =require('node-datachannel/polyfill');
28
28
for (const key inwrtc) {
29
29
(globalasany)[key] = (wrtcasany)[key];
30
30
}
31
31
```
32
32
33
33
### Transport
34
34
35
-
Communicating with your Viam machine in Node requires the use of a custom transport. In your app's entrypoint, you will also need to register the custom transport:
35
+
Communicating with your Viam machine in Node.js requires the use of a custom transport. In your app's entrypoint, you will also need to register the custom transport:
Copy file name to clipboardExpand all lines: examples/node/README.md
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
-
# Viam SDK Quickstart - Node
1
+
# Viam SDK Quickstart - Node.js
2
2
3
3
This example demonstrates how to connect to a machine using Node.js.
4
4
5
5
## Usage
6
6
7
-
You must have a `.env` file in this directory with the following connection info which can be easily found in the TypeScript code sample for your machine.
7
+
You must have a `.env` file in this directory with the following connection info which can be easily found in the TypeScript code sample for your machine. Use the `authEntity` value from the Code Sample as the `API_KEY_ID` and the `payload` value as the `API_KEY`.
8
8
9
9
```
10
10
HOST="<HOST>"
@@ -42,18 +42,18 @@ The `main.ts` file was updated to include the following polyfills and updates:
0 commit comments