Moving from v5 to v6
This guide is intended to assist you with the update to version 6 of the SuperViz SDK. It will focus on side-by-side comparisons for similar operations between the two versions.
If you need any help when migrating, you can join our Discord server, where we can help you with the migration.
This update has a few breaking changes, but it should be relatively easy to update your codebase.
Importing the SDK
In version 6, we have changed the way you import the SDK components, now you can import the components directly from the SDK package, instead of importing them from the lib/components
folder.
- import Room from '@superviz/sdk'
- import { Comments } from '@superviz/sdk/lib/components'
+ import Room, { Comments } from '@superviz/sdk'
Real-time Data Engine
In version 6, we have made major changes to our real-time data engine. We updated how you subscribe to an event and how you fetch the data history.
Subscribing to an event
We updated the way you subscribe to an event, now instead of receiving a list of events, you will receive a single event object.
Fetching data history
We have also updated the way you fetch the data history, previously it would return only the last data for the event, but now it returns a list of event calls for both scenarios: when you want a comprehensive list of all events or when you want to fetch only one specific event.
Make sure to update your code to receive a list of data instead of a single object when working with the fetchHistory
method.