In this guide, you’ll learn how to use integrate Liveblocks with Vue.js. The
@liveblocks/client
package provides the Liveblocks Presence and Storage APIs
you’ll be integrating with.
This guide assumes that you’re already familiar with Vue.js.
Run the following command to install the Liveblocks client package:
@liveblocks/client
lets you connect to Liveblocks servers.
Liveblocks does not have a package for Vue.js as we have for React. If you would like to have one, or even better if you have ideas about what kind of API you would like to use, please let us know about it on this Github issue.
To connect to Liveblocks, you need to create a Liveblocks client with
createClient
inside one of your Vue component.
Liveblocks should now be installed into your project!
A room is the virtual space where people collaborate. To create a multiplayer experience, you’ll need to connect your users to a Liveblocks room following the instructions below.
You can easily connect to a room by using client.enter
as shown below.
Now that we have our room setup, we can start using Liveblocks Client methods to
share any kind of data between users. For instance, Room.subscribe.others
allows us to subscribe to the other users updates.
Using the public key allows you to use Liveblocks without implementing your own authentication endpoint. It’s great for prototyping and marketing websites.
If you want to implement your own security and define if the current user has access to a specific room, you can follow the Authentication guide.
If you are using Nuxt.js, you can also check the Nuxt.js Authentication guide.