All Projects → carlosCharz → fcmxmppserverv2

carlosCharz / fcmxmppserverv2

Licence: other
XMPP Connection Server for FCM using the latest version of the Smack library (4.3.4) + Connection Draining Implementation

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to fcmxmppserverv2

Pushraven
A simple Java library to interface with Firebase Cloud Messaging (FCM) API. Pushraven allows you to push notifications to clients in very few lines of code.
Stars: ✭ 67 (+55.81%)
Mutual labels:  fcm, firebase-cloud-messaging
Fcm
Firebase Cloud Messaging (FCM) notifications channel for Laravel
Stars: ✭ 169 (+293.02%)
Mutual labels:  fcm, firebase-cloud-messaging
Push Receiver
A library to subscribe to GCM/FCM and receive notifications within a node process.
Stars: ✭ 125 (+190.7%)
Mutual labels:  fcm, firebase-cloud-messaging
Applozic Android Sdk
Android Real Time Chat & Messaging SDK
Stars: ✭ 611 (+1320.93%)
Mutual labels:  fcm, firebase-cloud-messaging
mod push appserver
Simple and extendable appserver for XMPP pushes (aka. XEP-0357)
Stars: ✭ 24 (-44.19%)
Mutual labels:  xmpp, fcm
Pyfcm
Python client for FCM - Firebase Cloud Messaging (Android, iOS and Web)
Stars: ✭ 674 (+1467.44%)
Mutual labels:  fcm, firebase-cloud-messaging
Electron Push Receiver
A module to bring Web Push support to Electron allowing it to receive notifications from Firebase Cloud Messaging (FCM).
Stars: ✭ 158 (+267.44%)
Mutual labels:  fcm, firebase-cloud-messaging
laravel-firebase
Laravel FCM (Firebase Cloud Messaging) Notification Channel
Stars: ✭ 25 (-41.86%)
Mutual labels:  fcm, firebase-cloud-messaging
Fcm Toolbox
📲 Firebase Cloud Messaging toolbox
Stars: ✭ 217 (+404.65%)
Mutual labels:  fcm, firebase-cloud-messaging
Go Fcm
Firebase Cloud Messaging ( FCM ) Library using golang ( Go )
Stars: ✭ 212 (+393.02%)
Mutual labels:  fcm, firebase-cloud-messaging
Fcm Django
FCM Django: Send push notifications via django to websites, iOS & android mobile devices through FCM (Firebase Cloud Messaging)
Stars: ✭ 495 (+1051.16%)
Mutual labels:  fcm, firebase-cloud-messaging
FCM-OnDeviceNotificationScheduler
Demo implementation to Schedule FCM Notifications on Android Device using AlarmManager + WorkManager.
Stars: ✭ 111 (+158.14%)
Mutual labels:  fcm, firebase-cloud-messaging
Fcm
Ruby bindings to Firebase Cloud Messaging (FCM) for Android, iOS or Web
Stars: ✭ 409 (+851.16%)
Mutual labels:  fcm, firebase-cloud-messaging
Kotlin Firebase Group Chat
Group and OneonOne chat using firebase built in Kotlin similar to whatsapp.
Stars: ✭ 44 (+2.33%)
Mutual labels:  fcm, firebase-cloud-messaging
Java-fcm
Java wrapper library to send messages to Android clients through Firebase Cloud Messaging
Stars: ✭ 29 (-32.56%)
Mutual labels:  fcm, firebase-cloud-messaging
Rpush
The push notification service for Ruby.
Stars: ✭ 1,886 (+4286.05%)
Mutual labels:  fcm, firebase-cloud-messaging
andpush
Android Push Notification in Ruby: The fastest client for FCM (Firebase Cloud Messaging)
Stars: ✭ 83 (+93.02%)
Mutual labels:  fcm, firebase-cloud-messaging
FCMBundle
A Bundle for Symfony projects to send notifications in mobile devices through Firebase Cloud Messaging API
Stars: ✭ 43 (+0%)
Mutual labels:  fcm, firebase-cloud-messaging
Qiscus Sdk Android
Qiscus provide everything you need to power up your app with chats. And it's now made simple.
Stars: ✭ 175 (+306.98%)
Mutual labels:  fcm, firebase-cloud-messaging
fcm
Golang client library for Firebase Cloud Messaging.
Stars: ✭ 22 (-48.84%)
Mutual labels:  fcm, firebase-cloud-messaging

XMPP Connection Server for FCM (Upgrade from Smack 3.x to 4.x) + Connection Draining Implementation

This is an upgrade of my last FCM XMPP Connection Server application. Now, this project uses the latest version at this time of the Smack library (4.3.4). I just added the connection draining implementation to this project. If you had some problems check my troubleshooting section!

The new version has introduced new terminology, deprecated some older methods and enriched the library in general. The problem started when there is a no working example out there using the new version to build a XMPP CCS for FCM. In summary, the API changes from the 3.x to the 4.x version are:

  1. XMPPConnection is now an interface. Use either AbstractXMPPConnection or one of its subclasses (XMPPTCPConnection).
  2. XMPPConnection.addPacketListener is deprecated: use either addAsyncPacketListener or addSyncPacketListener.
  3. Packet became a deprecated interface. Use the new Stanza class.
  4. The Packet Extension term is now Extension Element.
  5. Some methods of ConnectionListener that belongs to the reconnection were moved to ReconnectionListener.

For more information you must read the following documentation:

ADDITIONAL USEFUL LINKS

New Smack libraries

How to start the server

Just because it is the same project as my prior solution, the way to start the server is exactly the same. You can read my how to start the server.

Troubleshooting

This is a simple java code. You can integrate with just spring or spring in a container (Tomcat for example). In any case you need to take into account these issues:

  1. If using a simple java application, keep the application alive listening messages. This problem occurs when you use a simple java code as a daemon in linux (that's why I put the while true workaround).

  2. If using a java server (with spring boot at least), close the XMPP connection when the server goes down. This problem occurs when even if you shutdown the server the XMPP connection is still open and handling incoming messages. I do not know yet if this is a spring boot problem. The thing is like we are wrapping the XMPP CCS Server into a HTTP interface just to treat it as a normal server. My workaround was putting the disconnection in the spring preDestroy. @PreDestroy public void springPreDestroy() { //ccsConnection.disconnect(); }

  3. Reconnection when connection draining. The reconnection should be handled to connect again to the FCM using the same parameters with a backoff strategy. Smack can handle the automatic reconnection if you enable it but if the connection will be closed from the FCM side you should call your reconnection method when FCM sends connection draining control message or connection draining error message.

  4. Handle properly the new connection creation. If you handle differently the connection draining or use the reconnect. Always make sure that when you create a new connection the old one is completely closed gracefully to avoid phantom connections!

About me

I am Carlos Becerra - MSc. Softwware & Systems. You can contact me via:

Thanks

To tell the truth. I was really worried looking for the right solution. Finally, I made a list of useful links (apart from the above documentation links).

Any improvement or comment about the project is always welcome! As well as others shared their code publicly I want to share mine! Thanks!

License

Copyright 2020 Carlos Becerra

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].