import {hop} from '@onehop/client';// hop.init should be called as early as possible in your application's lifecyclehop.init({ projectId: 'project_xxx', // replace with your project ID});
Unprotected channels allow anyone to connect as long as they know the channel id. You can learn more about types of channels on this page.
Copy
Ask AI
import {hop} from '@onehop/client';const instance = hop.init({projectId: ''});// Subscribe this client to a channelinstance.subscribeToChannel('HopIsReallyCool');instance.on('STATE_UPDATE', data => { console.log(`Look at all those chickens`, data.state);});