Skip to content

Commit 803eee0

Browse files
MeemawMichael Cohen
andauthored
docs: nodejs example (#98)
* docs: nodejs example * prettier fix Co-authored-by: Michael Cohen <[email protected]>
1 parent 5c82e66 commit 803eee0

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ This is a best effort delivery messaging system. Messages that are not received
2020
We recommend switching to Node.js version 16 to make sure common crypto dependencies work. Our minimum supported version is 16.11.0.
2121

2222
- Install this package with `npm install @opensea/stream-js`
23+
- **NodeJS only:** Install the WebSocket library with `npm install ws`
2324
- Install the required dev-dependency to use the Phoenix client for web socket connections `npm install --save-dev @types/phoenix`
2425

2526
# Getting Started
@@ -30,6 +31,8 @@ In order to make onboarding easy, we've integrated the OpenSea Stream API with o
3031

3132
## Create a client
3233

34+
### Browser
35+
3336
```javascript
3437
import { OpenSeaStreamClient } from '@opensea/stream-js';
3538

@@ -38,6 +41,20 @@ const client = new OpenSeaStreamClient({
3841
});
3942
```
4043

44+
### Node.JS
45+
46+
```javascript
47+
import { OpenSeaStreamClient } from '@opensea/stream-js';
48+
import { WebSocket } from 'ws';
49+
50+
const client = new OpenSeaStreamClient({
51+
token: 'openseaApiKey'
52+
connectOptions: {
53+
transport: WebSocket
54+
}
55+
});
56+
```
57+
4158
You can also optionally pass in:
4259

4360
- a `network` if you would like to access testnet networks.

0 commit comments

Comments
 (0)