Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wherer i can find this param "subscription_id" ? #1237

Open
katfionn opened this issue Dec 11, 2024 · 0 comments
Open

Wherer i can find this param "subscription_id" ? #1237

katfionn opened this issue Dec 11, 2024 · 0 comments
Labels
question This is a question

Comments

@katfionn
Copy link

katfionn commented Dec 11, 2024

Question
where i can find subscription_id?

Detail

I note that sw.js in official demo got this:

const handlePushMessage = async (data) => {
  const { subscription_id: subscriptionId, message } = data;

  await self.registration.showNotification(message.topic, {
    body: message.body,
    icon: "/icon.png",
    badge: "/badge.png",
  });
};

But when i print the log in console after subscrib with websocket, here's the response i got. There's no such thing call subscription_id.

{
   "actions": [
      {
         "action": "view",
         "clear": true,
         "id": "Lmq5KevWsu",
         "label": "查看文章",
         "url": "https://71.gold/?post=69665"
      },
      {
         "action": "view",
         "clear": true,
         "id": "xn4Ur47Dkt",
         "label": "访问首页",
         "url": "https://71.gold/"
      }
   ],
   "attachment": {
      "name": "阿里云盘4K影视.webp",
      "url": "https://source.71.gold/img/阿里云盘4K影视.webp"
   },
   "content_type": "text/markdown",
   "event": "message",
   "expires": 1733920817,
   "id": "lVf6uucYIFi7",
   "message": "1、[🖼 名称:自由职业者 (2023) 4K 中英外挂字幕 描述:一名前特种部队特工在记者采访独裁者时接受了一份为她提供安全保障的工作,但当采访过程中爆发军事政变时...](https://t.me/Aliyun_4K_Movies/29392) —— 2024-12-11 08:31:02 \n\n![](https://cdn1.cdn-telegram.org/file/HebvhIlRXJxf9N2QKNLe1x9U0pUXkKuKvCoR8Ut_0jewJnP81WYj78zvtmGljiAk1FHGuw1OKdeuDvzpnp0Kzz6t4TpQUZrwiZ3KNhCtNaMSJ5iBeruPVk4kZspsp59TTuXfxpXPw_q3xnf8z3OMltckmWSH4UoIkyE6a5p4RKm9CMWZ9wlXSiUBqiXr5VAYEIDUI6wuFBhhXmNZbb1QKSJ2knQkx17jvQtL332zA2pK4uvwqul81SPYz-B8_ZRyX6-48vnQyy-GOBmzjOQ2TJXIcEAa9vMMCLuiVbyEf72GnJnTH1h2idk-4JWdC5RGbN-p22BhA-IL5SQ3HsTP0g.jpg)",
   "priority": 3,
   "time": 1733877617,
   "title": "🎞影音大全有新资讯了",
   "topic": "YJr3F1HNZXDs1fzCAltAdVQIz-HC-xVvnYQYnLul_oI"
}

I don't have any experience or bacsic knowledge about Javascript, All my code are relied on AI, so any help or instructions will be greatful.

@katfionn katfionn added the question This is a question label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question This is a question
Projects
None yet
Development

No branches or pull requests

1 participant