Service Nearing End of LifeThis service may be fully removed by Mysten any day now. Deprecation was announced in the testnet-v1.28.2 release notes on July 2, 2024. Mysten is working on a new streaming subscription API as a part of the new gRPC API (which will eventually replace the JSON-RPC API). This streaming service has a tentative GA of Sept 2025. !We cannot guarantee that Mysten will support the current Websocket API until the new service is in GA so we advise against using it!
- For the JSON_RPC API, the
suix_queryEvents
andsuix_queryTransactionBlocks
methods will still be supported moving forward (of course, this is a polling and not a listening approach). - Removal is expected to follow standard procedure, meaning it would leave Testnet first and then Mainnet a week or two later.
Overview
This service allows clients to subscribe to real-time event streams of transactions and events generated by the Sui network.Authentication, Connection and Subscription Limits, and Error Handling
Authentication See our Authentication and API Keys guide, which includes guidance on how to assign the maximum number of WebSocket Service connections and subscriptions an API key is allowed. The number you set for a key applies to both. Region URL and Sui network table You’ll need to make sure you use the region URL you want, along with a Node Service API access key created in that region.Region name | Location | Networks offered | Service URL (same URL for all networks offered) | Only works with API keys made in |
---|---|---|---|---|
US East - us1 | Eastern United States | Testnet, Mainnet | wss://api.us1.shinami.com/sui/node/v1 | US East - us1 |
Tokyo - apac1 | Tokyo, Japan | Mainnet | wss://api.apac1.shinami.com/sui/node/v1 | Tokyo - apac1 |
-31011
.
Error Handling
See our Error Reference for guidance on the errors you may receive from our services, including a section on errors specific to the WebSocket API.
Connecting to our WebSocket Service
Below is an example of connecting to our WebSocket service, subscribing to an event stream, and then unsubscribing. The examples use the command line tool wscat, the Shinami Clients SDK, and the Mysten Rust SDK. Replace all instances of {{name}} with the actual value for that nameMethods
(deprecated) suix_subscribeEvent
BE PREPARED:Active Websocket connections will be broken when our Fullnodes restart (due to regular protocol upgrades, auto-restarts due to a health issue, etc). Make sure that you have a way to handle a broken connection and reconnect.
Subscribe to a Sui event stream that matches a provided filter. For each event that matches the filter, a notification with the event data and subscription ID is returned to the client. Deprecated. See notice attop of page. Params
filter
:SuiEventFilter
- enables fine control of the event subscription stream using one or a combination of event attribute filters, as detailed in the Event filters section- Shinami TypeScript SDK only:
onMessage
: Function of type(SuiEvent) => void
to be called when a message is received in the event stream.
US East - us1
region URL since it is currently the only region where we offer Testnet. To send to another region, see the top of this page. The examples use the command line tool wscat, the Shinami Clients SDK, and the Mysten Rust SDK.
Replace all instances of {{name}} with the actual value for that name
- wscat
- An integer value representing the subscription id. Use to unsubscribe with
suix_unsubscribeEvent
- An integer value representing the subscription id. Use to unsubscribe with
- Shinami TypeScript SDK
- A function with no parameters that returns a boolean. Call this to unsubscribe from the subscription you just created. Returns
true
when the un-subscription was successful.
- A function with no parameters that returns a boolean. Call this to unsubscribe from the subscription you just created. Returns
- Mysten Rust SDK
SuiEvent
and the subscription id for this event stream.
(deprecated) suix_unsubscribeEvent
DescriptionUnsubscribe from a Sui event stream. Deprecated. See notice attop of page. Params
- wscat only
subscription_id
: the ID of the subscription you are unsubscribing to
suix_subscribeEvent
example. The examples use the command line tool wscat and the Shinami Clients SDK.
Replace all instances of {{name}} with the actual value for that name
- A
Boolean
representing whether the un-subscription attempt was successful.
(deprecated) suix_subscribeTransaction
BE PREPARED:Active Websocket connections will be broken when our Fullnodes restart (due to regular protocol upgrades, auto-restarts due to a health issue, etc). Make sure that you have a way to handle a broken connection and reconnect.
Subscribe to a Sui transaction stream that matches the provided filter. Deprecated. See notice attop of page. Params
-
filter
:TransactionFilter
Note:TheFromOrToAddress
,Checkpoint
,TransactionKind
, andTransactionKindIn
filters do not work for WebSocket subscriptions. -
Shinami TypeScript SDK only:
onMessage
: Function of type(TransactionEffects) => void
to be called when a transaction is received. SeeTransactionEffects
for more info.
US East - us1
region URL since it is currently the only region where we offer Testnet. To send to another region, see the top of this page. The examples use the command line tool wscat, the Shinami Clients SDK, and the Mysten Rust SDK.
Replace all instances of {{name}} with the actual value for that name
- wscat
- An integer value representing the subscription id. Use to unsubscribe with
suix_unsubscribeTransaction
- An integer value representing the subscription id. Use to unsubscribe with
- Shinami TypeScript SDK
- A function with no parameters that returns a boolean. Call this to unsubscribe from the subscription you just created. Returns
true
when the un-subscription was successful.
- A function with no parameters that returns a boolean. Call this to unsubscribe from the subscription you just created. Returns
- Mysten Rust SDK
- TransactionEffects and the subscription id for this event stream.
(deprecated) suix_unsubscribeTransaction
DescriptionUnsubscribe from a Sui transaction stream. Deprecated. See notice attop of page. Params
- wscat only
subscription_id
: the ID of the subscription you are unsubscribing to
suix_subscribeTransaction
example. The examples use the command line tool wscat and the Shinami Clients SDK.
Replace all instances of {{name}} with the actual value for that name
- A
Boolean
representing whether the un-subscription attempt was successful.
Event and Transaction Filter Examples
Event Filter Examples
The following examples demonstrate how to use the variousSuiEventFilter
options. The examples use the command line tool wscat and the Shinami Clients SDK.
Note that the
TimeRange
filter does not successfully match events.US East - us1
region URL since it is currently the only region where we offer Testnet. To send to another region, see the top of this page. The examples use the command line tool wscat, the Shinami Clients SDK, and the Mysten Rust SDK.
Replace all instances of {{name}} with the actual value for that name
Transaction Filter Examples
The following examples demonstrate how to use the variousTransactionFilter
options. The examples use the command line tool wscat and the Shinami Clients SDK. They also use our US East - us1
region URL since it is currently the only region where we offer Testnet. To send to another region, see the top of this page.
The
FromOrToAddress
, Checkpoint
, TransactionKind
, and TransactionKindIn
filters do not successfully match transactions.