Closed jellyjoji closed 1 year ago
PocketBase가 지원하는 것은 실시간 데이터베이스(realtime database) 기능입니다. 현재 알림 푸시(Push Notification) 기능을 지원하지는 않습니다.
알림 API 서비스를 직접 구현하는 것은 매우 어려운 일입니다. 그러므로 유연하고 안정적인 알림 API를 제공하는 [Knock](https://knock.app/)과 같은 서비스를 활용하는 것을 권장합니다. 게다가 Knockd은 Next.js 프레임워크를 만든 Vercel에서 선택한 알림 API입니다. ([참고](https://vercel.com/blog/building-a-powerful-notification-system-for-vercel-with-knock-app))
Knock은 소규모 앱 또는 개발자 테스트 용도인 경우 무료 사용이 가능합니다. (최대 10,000건/월)
아래 공식문서는 Knock을 백엔드 앱과 통합하고 Knock을 사용하여 첫 번째 알림을 보내는 방법을 안내합니다. Knock 서비스에 먼저 가입한 다음, PocketHost처럼 대시보드를 통해 설정해야 합니다.
[Get started with Knock | Knock Docs](https://docs.knock.app/getting-started/quick-start)
[@knocklabs/react-notification-feed](https://github.com/knocklabs/react-notification-feed)
라이브러리를 사용하면 Knock의 알림 피드 API를 사용하여 알림 환경을 만들 수 있습니다. 제품의 모든 기능을 갖춘 알림 피드 환경을 쉽게 시작하고 실행하는데 사용 가능한 미리 구축된 UI 컴포넌트 또한 함께 제공됩니다.
아래는 React 앱으로 구성된 라이브 데모입니다. Message 입력 필드에 메시지를 입력한 다음 Send notification
버튼을 누르면 Knock 서비스를 통해 알림 요청 후 잠시 뒤 알림이 도착합니다.
https://knock-in-app-notifications-react.vercel.app/
자세한 사용법은 아래 공식 문서를 참고하세요.
[Building in-app UI in React | Knock Docs](https://docs.knock.app/in-app-ui/react/overview)
아래 5분 영상 데모로 Knock을 사용하여 인앱, 이메일, Slack 등 여러 제품에 알림을 제공하는 것을 보여줍니다.
내용
저희가 만든 “공구룸” 웹앱 서비스에서 알림 기능을 구현하려고 합니다.
포켓베이스 리얼타임 기능을 활용하면 푸시 알림 기능을 구현할수 있을것 같은데 푸시알림에 대한 자료를 검색하면 firebase 관련 자료밖에 나오지 않아서 알림 기능 구현 방법에 대해 문의합니다.
적용할 알림 기능 정리
관심 상품 등록
filter : ~ 상품이름 포함
찾아본 푸시 알림 자료
[Kakao Developers](https://developers.kakao.com/docs/latest/ko/push/rest-api)
[React에서 Browser Notification (푸시 알림) 구현하기](https://mingule.tistory.com/68)
[Notifications API Standard](https://notifications.spec.whatwg.org/)
function NotificationSender() { const [message, setMessage] = useState('');
const sendNotification = async () => { try { const response = await fetch('YOUR_POCKETBASE_API_URL/send-notification', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_AUTH_TOKEN', }, body: JSON.stringify({ message }), });
};
return (
Send Notification
); }
export default NotificationSender;