Giter Club home page Giter Club logo

Comments (6)

NeuroWhAI avatar NeuroWhAI commented on June 11, 2024

아직까지 해당 오류는 안 나왔고 현상도 안 나옴. 흠...

from isekaidol-stream-noti.

NeuroWhAI avatar NeuroWhAI commented on June 11, 2024

1분까진 아니고 십수초 늦는 경우는 봤음.
폴링 방식이 그 자체의 딜레이도 있지만 서버측에서도 캐싱 때문에 늦을 수 있다고 함.

그래서 웹훅 방식을 고려해볼까 싶음.
EventSub라고 부르는데 HTTPS 콜백을 등록해두면 됨.

콜백 등록은 특정 사유(토큰/비번 변경, 느린 응답)가 있는 게 아니면 계속 유지된다고 함.
Twitch CLI 사용해서 등록 가능.

twitch api post eventsub/subscriptions -b '페이로드'

페이로드 표준 : https://dev.twitch.tv/docs/api/reference#create-eventsub-subscription
뱅온 : https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types#streamonline
방제, 카테고리 변경 : https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types#channelupdate

콜백 등록하는 건 package.json의 scripts에 넣어서 쉽게 할 수 있도록. (시크릿 토큰 등은 당연히 숨기고.)

일단은 바로 적용하지 말고 로그만 남기게 해서 기존 기능과 속도(폴링 방식보다 느리면 무쓸모), 신뢰도(호출이 안 되거나 중복되는 경우가 있을수도?) 비교.
중복되는 경우 있었음. 뱅온도 중복될 수 있으니 똑같이 DB 확인하자.
속도는 평균적으로 빠르긴 한데 기타 딜레이 때문에 종종 조금 느린 경우도 있음.

뱅온은 그냥 바로 알리면 되는데 채널 정보 변경 이벤트는 DB랑 비교해서 방제, 카테고리 하나 이상 바뀌었을 때에만 DB 갱신하고 알려야 함.
근데 DB 갱신을 여기에 다 의존하면 이벤트를 놓쳤을 경우 웹 사이트에 표시되는 정보가 틀리게 됨.
웹 사이트 정보는 기존처럼 폴링으로 하고 알림 전용으로 DB 데이터 하나 더 만들자.

from isekaidol-stream-noti.

NeuroWhAI avatar NeuroWhAI commented on June 11, 2024

콜백 함수에서 실제 알림 보내면 콜백 반환이 늦어지니 PubSub 함수를 호출해서 위임하고 바로 반환.
특정 토픽으로 PubSub 함수를 호출할 수 있다고 함.

PubSub 함수 작성 : https://firebase.google.com/docs/functions/pubsub-events?hl=ko
PubSub 함수 호출 : https://cloud.google.com/pubsub/docs/publisher#node.js

from isekaidol-stream-noti.

NeuroWhAI avatar NeuroWhAI commented on June 11, 2024

EventSub 기대보다 느리다.
다른 방식을 쓸거면 차라리 웹 크롤링을 해야하나?

from isekaidol-stream-noti.

NeuroWhAI avatar NeuroWhAI commented on June 11, 2024

리전 차이도 있지 않을까 싶음.

from isekaidol-stream-noti.

NeuroWhAI avatar NeuroWhAI commented on June 11, 2024

잘가 트위치

from isekaidol-stream-noti.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.