logo

Subscriptions

The @bastaai/basta-js SDK exposes a simple way to subscribe to a GraphQL Subscription, making it possible to have live updates in your application.
First, you need to install the package: npm install @bastaai/basta-js.
Next, you need to initialize the subscription client.
typescript
import { initBasta } from '@bastaai/basta-js'; const basta = initBasta(); const dispose = basta.subscribeTo.item({ onUpdate: (data) => console.log(data), variables: { itemIds: ["{itemId}"], saleId: "{saleId}", }, userToken: "{userToken}" })
Provide a userToken to get personalized socket data (userBids). Example userToken would be the GUID for your user.
Remember to call the dispose function when you are done with the subscription to clean up resources.

Powered by Notaku
Share