Connecting
Prerequisites
In order to connect, you need a PEER_TOKEN
and the FISHJAM_URL
.
Connecting
Use the useConnect
hook to get the connect
function.
import { connect } from "@fishjam-cloud/react-client";
function Component() {
const connect = useConnect();
const joinRoom = async () => {
await connect({
token: PEER_TOKEN,
url: FISHJAM_URL,
});
};
}
Disconnecting
In order to close connection, use the useDisconnect
hook.
import { useDisconnect } from "@fishjam-cloud/react-client";
const disconnect = useDisconnect();
await disconnect();