
Security News
Meet Socket at Black Hat Europe and BSides London 2025
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.
@opensea/stream-js
Advanced tools
A TypeScript SDK to receive pushed updates from OpenSea over websocket
A TypeScript SDK for receiving updates from the OpenSea Stream API - pushed over websockets. We currently support the following event types on a per-collection basis:
This is a best effort delivery messaging system. Messages that are not received due to connection errors will not be re-sent. Messages may be delivered out of order. This SDK is offered as a beta experience as we work with developers in the ecosystem to make this a more robust and reliable system.
Documentation: https://docs.opensea.io/reference/stream-api-overview
Please use Node.js version 16 or greater to make sure common crypto dependencies work.
npm install @opensea/stream-jsnpm install --save-dev @types/phoenixnpm install ws node-localstorageIn order to make onboarding easy, we've integrated the OpenSea Stream API with our existing API key system. The API keys you have been using for the REST API should work here as well. If you don't already have one, you can create an API key in your OpenSea account settings.
import { OpenSeaStreamClient } from '@opensea/stream-js';
const client = new OpenSeaStreamClient({
token: 'YOUR_OPENSEA_API_KEY'
});
import { OpenSeaStreamClient } from '@opensea/stream-js';
import { WebSocket } from 'ws';
import { LocalStorage } from 'node-localstorage';
const client = new OpenSeaStreamClient({
token: 'YOUR_OPENSEA_API_KEY',
connectOptions: {
transport: WebSocket,
sessionStorage: LocalStorage
}
});
You can also optionally pass in:
network parameter (defaults to Network.MAINNET)apiUrl if you would like to access another OpenSea Stream API endpoint. Not needed if you provide a network or use the default values.onError callback to handle errors. The default behavior is to console.error the error.logLevel to set the log level. The default is LogLevel.INFO.The OpenSea Stream API is available on mainnet:
wss://stream.openseabeta.com/socket
The client will automatically connect to the socket as soon as you subscribe to the first channel. If you would like to connect to the socket manually (before that), you can do so:
client.connect();
After successfully connecting to our websocket it is time to listen to specific events you're interested in!
We will only send out metadata updates when we detect that the metadata provided in tokenURI has changed from what OpenSea has previously cached.
client.onItemMetadataUpdated('collection-slug', (event) => {
// handle event
});
client.onItemListed('collection-slug', (event) => {
// handle event
});
client.onItemSold('collection-slug', (event) => {
// handle event
});
client.onItemTransferred('collection-slug', (event) => {
// handle event
});
client.onItemReceivedBid('collection-slug', (event) => {
// handle event
});
client.onItemReceivedOffer('collection-slug', (event) => {
// handle event
});
client.onEvents(
'collection-slug',
[EventType.ITEM_RECEIVED_OFFER, EventType.ITEM_TRANSFERRED],
(event) => {
// handle event
}
);
client.onItemCancelled('collection-slug', (event) => {
// handle event
});
If you'd like to listen to an event from all collections use wildcard * for the collectionSlug parameter.
Types are included to make working with our event payload objects easier.
All subscription methods return a callback function that will unsubscribe from a stream when invoked.
const unsubscribe = client.onItemMetadataUpdated('collection-slug', noop);
unsubscribe();
client.disconnect();
See the contributing guide for detailed instructions on how to get started with this project.
MIT Copyright 2022 Ozone Networks, Inc.
FAQs
A TypeScript SDK to receive pushed updates from OpenSea over websocket
The npm package @opensea/stream-js receives a total of 1,370 weekly downloads. As such, @opensea/stream-js popularity was classified as popular.
We found that @opensea/stream-js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 10 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.

Security News
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.