import{connect}from'@studioxid/omni-adapter';constclient = awaitconnect({secretKey:process.env.CONNECT_TOKEN!,displayName:'smart-home-dashboard',sends:['climate.temperature.request'],receives:['climate.temperature'],});// Receive the confirmed temperature.client.on('climate.temperature',(msg)=>{console.log('Confirmed temperature:',msg.value);// Update the dashboard through your app's UI logic.});// Call this from your server-side handler// when the user changes the temperature.exportasyncfunctionrequestTemperature(value: number){awaitclient.send('climate.temperature.request',value);}client.on('error',(err)=>{console.error(`[${err.code}] ${err.hint ?? err.message}`);});for(constsignalof['SIGINT','SIGTERM']asconst){process.once(signal,()=>voidclient.close());}
import{connect}from'@studioxid/omni-adapter';constclient = awaitconnect({secretKey:process.env.CONNECT_TOKEN!,displayName:'smart-home-dashboard',sends:['climate.temperature.request'],receives:['climate.temperature'],});// Receive the confirmed temperature.client.on('climate.temperature',(msg)=>{console.log('Confirmed temperature:',msg.value);// Update the dashboard through your app's UI logic.});// Call this from your server-side handler// when the user changes the temperature.exportasyncfunctionrequestTemperature(value: number){awaitclient.send('climate.temperature.request',value);}client.on('error',(err)=>{console.error(`[${err.code}] ${err.hint ?? err.message}`);});for(constsignalof['SIGINT','SIGTERM']asconst){process.once(signal,()=>voidclient.close());}
import{connect}from'@studioxid/omni-adapter';constclient = awaitconnect({secretKey:process.env.CONNECT_TOKEN!,displayName:'smart-home-dashboard',sends:['climate.temperature.request'],receives:['climate.temperature'],});// Receive the confirmed temperature.client.on('climate.temperature',(msg)=>{console.log('Confirmed temperature:',msg.value);// Update the dashboard through your app's UI logic.});// Call this from your server-side handler// when the user changes the temperature.exportasyncfunctionrequestTemperature(value: number){awaitclient.send('climate.temperature.request',value);}client.on('error',(err)=>{console.error(`[${err.code}] ${err.hint ?? err.message}`);});for(constsignalof['SIGINT','SIGTERM']asconst){process.once(signal,()=>voidclient.close());}
import{connect}from'@studioxid/omni-adapter';constclient = awaitconnect({secretKey:process.env.CONNECT_TOKEN!,displayName:'smart-home-dashboard',sends:['climate.temperature.request'],receives:['climate.temperature'],});// Receive the confirmed temperature.client.on('climate.temperature',(msg)=>{console.log('Confirmed temperature:',msg.value);// Update the dashboard through your app's UI logic.});// Call this from your server-side handler// when the user changes the temperature.exportasyncfunctionrequestTemperature(value: number){awaitclient.send('climate.temperature.request',value);}client.on('error',(err)=>{console.error(`[${err.code}] ${err.hint ?? err.message}`);});for(constsignalof['SIGINT','SIGTERM']asconst){process.once(signal,()=>voidclient.close());}
import{connect}from'@studioxid/omni-adapter';constclient = awaitconnect({secretKey:process.env.CONNECT_TOKEN!,displayName:'smart-home-dashboard',sends:['climate.temperature.request'],receives:['climate.temperature'],});// Receive the confirmed temperature.client.on('climate.temperature',(msg)=>{console.log('Confirmed temperature:',msg.value);// Update the dashboard through your app's UI logic.});// Call this from your server-side handler// when the user changes the temperature.exportasyncfunctionrequestTemperature(value: number){awaitclient.send('climate.temperature.request',value);}client.on('error',(err)=>{console.error(`[${err.code}] ${err.hint ?? err.message}`);});for(constsignalof['SIGINT','SIGTERM']asconst){process.once(signal,()=>voidclient.close());}
이 예제는 대시보드의 Node.js 백엔드에서 실행됩니다. requestTemperature()와 수신된 값을 기존 UI 로직에 연결하세요. 브라우저 측 코드에 CONNECT_TOKEN을 노출하지 마세요.
Connect Omni 웹 뷰 레이어 내에 표시되는 브라우저 전용 대시보드의 경우 대신 어댑터의 Engine 프로필을 사용하세요. 자세한 내용은 Stage에 앱 표시하기를 참조하세요.