Supabase Realtime 완벽 가이드: 실시간 기능 구현하기
1분 읽기291
Supabase Realtime 가이드
실시간 기능을 쉽게 구현하는 방법을 알아봅니다.
기본 설정
import { createClient } from '@supabase/supabase-js'
const supabase = createClient(url, key)
// 실시간 구독
const channel = supabase
.channel('messages')
.on('postgres_changes',
{ event: 'INSERT', schema: 'public', table: 'messages' },
(payload) => {
console.log('New message:', payload.new)
}
)
.subscribe()
Presence 기능
온라인 상태를 추적할 수 있습니다.
Broadcast
클라이언트 간 메시지를 전송합니다.