Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Yayınlama/abone olma modeline dayanan FCM konu mesajlaşması, belirli bir konuyu etkinleştirmiş birden çok cihaza mesaj göndermenize olanak tanır. Konu iletilerini gerektiği gibi oluşturursunuz ve FCM, iletinin doğru cihazlara güvenilir bir şekilde yönlendirilmesini ve teslim edilmesini sağlar.
Örneğin, yerel bir gelgit tahmin uygulaması kullanıcıları "gelgit akıntıları uyarıları" konusunu etkinleştirerek belirli bölgelerde tuzlu su balıkçılığı için en uygun koşullarla ilgili bildirimler alabilir. Bir spor uygulaması kullanıcıları, tuttukları takımların canlı maç skorlarıyla ilgili otomatik güncellemelere abone olabilir.
Konularla ilgili olarak göz önünde bulundurulması gereken bazı noktalar:
Konu mesajlaşması, hava durumu gibi içerikler veya herkese açık diğer bilgiler için en uygun yöntemdir.
Kullanıcı başına birden fazla cihaza mesaj göndermeniz gerekiyorsa bu kullanım alanları için cihaz grubu mesajlaşmasını kullanabilirsiniz.
Konu mesajlaşma, her konu için sınırsız aboneliği destekler. Ancak FCM, şu alanlarda sınırları zorunlu kılar:
Bir uygulama örneği en fazla 2.000 konuya abone olabilir.
Uygulama örneklerine abone olmak için toplu içe aktarma özelliğini kullanıyorsanız her istek 1.000 uygulama örneğiyle sınırlıdır.
Yeni aboneliklerin sıklığı proje başına hız sınırlamasına tabidir. Kısa süre içinde çok fazla abonelik isteği gönderirseniz FCM sunucuları 429 RESOURCE_EXHAUSTED ("kota aşıldı") yanıtı verir. Eksponansiyel geri yüklemeyle yeniden deneyin.
İstemci uygulamasını bir konuya abone etme
İstemci uygulamaları, mevcut herhangi bir konuya abone olabilir veya yeni bir konu oluşturabilir. Bir istemci uygulaması yeni bir konu adına (Firebase projenizde henüz mevcut olmayan bir ad) abone olduğunda FCM'de bu ada sahip yeni bir konu oluşturulur ve daha sonra herhangi bir istemci bu konuya abone olabilir.
Bir konuya abone olmak için konu adıyla subscribeToTopic() işlevini çağırın. Bu yöntem, abonelik başarılı olduğunda çözümlenen bir Future döndürür:
Listeden çıkmak için konu adıyla birlikte unsubscribeFromTopic() numarasını arayın.
subscribeToTopic() ve unsubscribeFromTopic(), web istemcilerinde desteklenmez. Web kullanıcılarının aboneliklerini nasıl yöneteceğinizi öğrenmek için
Web/JavaScript'teki konulara mesaj gönderme başlıklı makaleyi inceleyin.
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 2025-09-05 UTC."],[],[],null,["\u003cbr /\u003e\n\nBased on the publish/subscribe model, FCM topic messaging allows you to send a message\nto multiple devices that have opted in to a particular topic. You compose topic messages as\nneeded, and FCM handles routing and delivering the message reliably to the right\ndevices.\n\nFor example, users of a local tide\nforecasting app could opt in to a \"tidal currents alerts\" topic and receive\nnotifications of optimal saltwater fishing conditions in specified areas. Users of a sports app\ncould subscribe to automatic updates in live game scores for their favorite\nteams.\n\nSome things to keep in mind about topics:\n\n- Topic messaging is best suited for content such as weather, or other publicly\n available information.\n\n- Topic messages are **optimized for throughput rather than latency** . For fast,\n secure delivery to single devices or small groups of devices,\n [target messages to registration tokens](/docs/cloud-messaging/send-message#send_messages_to_specific_devices),\n not topics.\n\n- If you need to send messages to multiple devices *per user* , consider\n [device group messaging](/docs/cloud-messaging/send-message#send_messages_to_device_groups)\n for those use cases.\n\n- Topic messaging supports unlimited subscriptions for each topic. However, FCM\n enforces limits in these areas:\n\n - One app instance can be subscribed to no more than 2000 topics.\n - If you are using [batch import](https://developers.google.com/instance-id/reference/server#manage_relationship_maps_for_multiple_app_instances) to subscribe app instances, each request is limited to 1000 app instances.\n - The frequency of new subscriptions is rate-limited per project. If you send too many subscription requests in a short period of time, FCM servers will respond with a `429 RESOURCE_EXHAUSTED` (\"quota exceeded\") response. Retry with exponential backoff.\n\nSubscribe the client app to a topic\n\nClient apps can subscribe to any existing topic, or they can create a new\ntopic. When a client app subscribes to a new topic name (one that does\nnot already exist for your Firebase project), a new topic of that name is\ncreated in FCM and any client can subsequently subscribe to it.\n\nTo subscribe to a topic, call `subscribeToTopic()` with the topic name. This method\nreturns a `Future`, which resolves when the subscription succeeded: \n\n await FirebaseMessaging.instance.subscribeToTopic(\"topic\");\n\nTo unsubscribe, call `unsubscribeFromTopic()` with the topic name.\n\n`subscribeToTopic()` and `unsubscribeFromTopic()` are not supported for web\nclients. To learn how to manage subscriptions for web users, see\n[Send messages to topics on Web/JavaScript](https://firebase.google.com/docs/cloud-messaging/js/topic-messaging).\n\nNext steps\n\n- Learn how to [send topic messages](/docs/cloud-messaging/send-message#send-messages-to-topics).\n- Learn how to [Manage topic subscriptions on the server](/docs/cloud-messaging/manage-topics)."]]