This reference assumes you have already set up the Hop server-side
SDK.
Updating State
Channel state can be updated (manually) through the Hop Console or (programatically) through our server-side SDKs.updating-state.js
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
How to update Hop Channel state
// Import your Hop SDK instance
import {hop} from '.';
const channelId = 'channel_xxx'; // the channel we want to update
/*
* - Option 1: Rewrite the state.
* - The existing state is passed as the first arument to Channel#setState
*/
hop.channels.setState(channelId, s => ({...s, name: 'My Channel'}));
/*
* - Option 2: Update or add variables
* - This operation will only effect the variables you specify.
* - The rest of the state will remain unchanged
*/
channel.patchState(channelId, {name: 'My Channel'});