Frontend Packages
@onehop/client: The core library used by all other framework-specific
packages. Can also be used independently.@onehop/react: Our React-specific implementations for Pipe and Channels.
Integrating Pipe with a React App
Installing dependencies
Start off by adding both of our frontend packages to your projectInitializing the Hop SDK
Grab your project ID from the Project Settings page. You should call theinit function outside of a React component. For example,
in your application’s entrypoint file:
Integrating Pipe with React Hooks
The@onehop/react package exposes a collection of React hooks which allow you
to easily implement product features into your app. We’ll focus on usePipeRoom
in this section.
usePipeRoom
usePipeRoom takes in an object as it’s first and only argument, consisting of
joinToken and ref, where ref is a
React reference to a video element.
Let’s jump into an example bare-minimum component:
usePipeRoom returns the following object:
| field | type | description | 
|---|---|---|
| live | boolean | whether the current room is live or offline | 
| canPlay | boolean | whether the room is able to play the stream | 
| susbcription | string | one of: available, unavailable, non_existent |