async function connect() { // set up an instance of the Ably realtime library const ably = new Ably.Realtime.Promise({ authUrl: '/api/createTokenRequest' }); // create a channel called "tshirt" const channelId = "tshirt"; //connect to the tshirt channel const channel = await ably.channels.get(channelId); await channel.attach(); //subscribe to the channel to get updates and call processMessage channel.subscribe(processMessage); } connect();