nordeus / pushkin Goto Github PK
View Code? Open in Web Editor NEWPushkin is a free open source tool for sending push notifications
License: MIT License
Pushkin is a free open source tool for sending push notifications
License: MIT License
At the moment Pushkin keeps all users and devices in database. Obsolete ones should be archived somehow and removed from login and device tables.
Obsolete user is the user who didn't login for X days, where X should be configurable. Obsolete device is the device which is unreachable (e.g. unregistered).
Add possibility to send parameters with event which could be used in notification.
APN has new API, we use deprecated one.
Hello, I'm trying to update the database to rise the server, but I'm receiving following error. I'd appreciate some help, I can't found what's the issue here.
postgres@ar-sta023:/home/rodrigo/pushkin$ pushkin --configuration config.ini --upgrade-db
INFO [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO [alembic.runtime.migration] Will assume transactional DDL.
Traceback (most recent call last):
File "/usr/local/bin/pushkin", line 11, in
load_entry_point('pushkin==0.1.6.1', 'console_scripts', 'pushkin')()
File "/var/lib/postgresql/.local/lib/python2.7/site-packages/pushkin/pushkin_cli.py", line 119, in main
database.upgrade_database()
File "/var/lib/postgresql/.local/lib/python2.7/site-packages/pushkin/database/database.py", line 55, in upgrade_database
alembic_command.upgrade(alembic_cfg, "head")
File "/var/lib/postgresql/.local/lib/python2.7/site-packages/alembic/command.py", line 254, in upgrade
script.run_env()
File "/var/lib/postgresql/.local/lib/python2.7/site-packages/alembic/script/base.py", line 425, in run_env
util.load_python_file(self.dir, 'env.py')
File "/var/lib/postgresql/.local/lib/python2.7/site-packages/alembic/util/pyfiles.py", line 93, in load_python_file
module = load_module_py(module_id, path)
File "/var/lib/postgresql/.local/lib/python2.7/site-packages/alembic/util/compat.py", line 75, in load_module_py
mod = imp.load_source(module_id, path, fp)
File "/var/lib/postgresql/.local/lib/python2.7/site-packages/pushkin/database/migrations/env.py", line 76, in
run_migrations_online()
File "/var/lib/postgresql/.local/lib/python2.7/site-packages/pushkin/database/migrations/env.py", line 71, in run_migrations_online
context.run_migrations()
File "", line 8, in run_migrations
File "/var/lib/postgresql/.local/lib/python2.7/site-packages/alembic/runtime/environment.py", line 836, in run_migrations
self.get_context().run_migrations(**kw)
File "/var/lib/postgresql/.local/lib/python2.7/site-packages/alembic/runtime/migration.py", line 321, in run_migrations
for step in self._migrations_fn(heads, self):
File "/var/lib/postgresql/.local/lib/python2.7/site-packages/alembic/command.py", line 243, in upgrade
return script._upgrade_revs(revision, rev)
File "/var/lib/postgresql/.local/lib/python2.7/site-packages/alembic/script/base.py", line 338, in _upgrade_revs
for script in reversed(list(revs))
File "/usr/lib/python2.7/contextlib.py", line 35, in exit
self.gen.throw(type, value, traceback)
File "/var/lib/postgresql/.local/lib/python2.7/site-packages/alembic/script/base.py", line 174, in _catch_revision_errors
compat.raise_from_cause(util.CommandError(resolution))
File "/var/lib/postgresql/.local/lib/python2.7/site-packages/alembic/util/compat.py", line 128, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb)
File "/var/lib/postgresql/.local/lib/python2.7/site-packages/alembic/script/base.py", line 143, in _catch_revision_errors
yield
File "/var/lib/postgresql/.local/lib/python2.7/site-packages/alembic/script/base.py", line 334, in _upgrade_revs
revs = list(revs)
File "/var/lib/postgresql/.local/lib/python2.7/site-packages/alembic/script/revision.py", line 642, in iterate_revisions
requested_lowers = self.get_revisions(lower)
File "/var/lib/postgresql/.local/lib/python2.7/site-packages/alembic/script/revision.py", line 299, in get_revisions
return sum([self.get_revisions(id_elem) for id_elem in id], ())
File "/var/lib/postgresql/.local/lib/python2.7/site-packages/alembic/script/revision.py", line 304, in get_revisions
for rev_id in resolved_id)
File "/var/lib/postgresql/.local/lib/python2.7/site-packages/alembic/script/revision.py", line 304, in
for rev_id in resolved_id)
File "/var/lib/postgresql/.local/lib/python2.7/site-packages/alembic/script/revision.py", line 359, in _revision_for_ident
resolved_id)
alembic.util.exc.CommandError: Can't locate revision identified by '34dd0bf00472'
Some notifications are not valid after some time. It can happen that user is offline, and if he become online when notification scheduled for him is not valid he should not receive that notification.
Currently, we are opening session, doing something, committing and closing a session in every function in database module. It is possible to make a mistake this way, we should make decorator for this use case.
After switching to new library for APN Pushkin logs status for Unregistered error only. For other errors status remains on -1 (ready) and that one is logged.
Will it upgrade from GCM to FCM?
https://firebase.google.com/docs/cloud-messaging/
There is a problem with encoding with some notifications:
UnicodeEncodeError: 'ascii' codec can't encode characters in position 37-38: ordinal not in range(128)
Hi! I was using this library and it's great.
I'm sending notifications like this
const notifications = await usuarios.map(u => {
return {
login_id: u.id,
title: notificacion.titulo,
content: notificacion.mensaje,
screen: 'home'
}
})enviado = http.post('/post_notification_json', JSON.stringify({ events: notifications }))
.then(() => true)
.catch((err) => {
logger.info('No se pudo enviar la notificacion: ' + err.message)
return false
})
The question is, is there any way to add custom params, like 'pairs' param on post_events_json endpoint?
Thank you so much
They refer to hard coded senders but now senders are created dinamically
If notifications have no priority set, they will take normal priority and that will result in notification delay during Doze and App Standby on Android device. To overcome this priority has to be set to high for notifications that have to be received at some exact time.
Documentation on this: https://developers.google.com/cloud-messaging/concept-options#setting-the-priority-of-a-message
Currently if more than one login id is registered on a single device push notifications for every login id will be sent to that device. This is usually not desired and should be configurable.
Hi,
Could you provide an example of Dockerfile setup for pushkin?
Hello everyone, the notifications for android are awesome, but I can't send it for iOs.
/var/log/pushkin/pushkin.log says this:
2017-10-25 17:02:17,902 ERROR Connection to APN lost, reconnecting and trying again
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pushkin-0.1.6.1-py2.7.egg/pushkin/sender/nordifier/pyapn2/client.py", line 48, in send_notification
stream_id = self.__connection.request('POST', url, json_payload, headers)
File "/usr/local/lib/python2.7/dist-packages/hyper/http20/connection.py", line 281, in request
self.endheaders(message_body=body, final=True, stream_id=stream_id)
File "/usr/local/lib/python2.7/dist-packages/hyper/http20/connection.py", line 546, in endheaders
stream = self._get_stream(stream_id)
File "/usr/local/lib/python2.7/dist-packages/hyper/http20/connection.py", line 289, in _get_stream
raise StreamResetError("Stream forcefully closed")
StreamResetError: Stream forcefully closed
Here is my config.ini:
[ServerSpecific]
game = PromoGo
world_id = 1
port = 8887
[Messenger]
dry_run = false
apns_batch_size = 500
apns_topic = PromoGo
apns_certificate_path = /home/promogo/pushkin/prod_push_nopass.pem
gcm_access_key = AAAAOfz579c:APA91bF8ekMFcL5P6AfzKYKk4nb_flPif1bLHgEc1zaxHxwK97T311Ln5Kk-orEs9JbOrayFpztI-CtOvBTiY9rde-KphsAA_yREX7MM2qIPISldJm$
apns_sandbox = false
connection_error_retries = 3
base_deeplink_url = application_name.com
[RequestProcessor]
queue_limit = 50000
request_processor_num_threads = 10
[Sender]
sender_queue_limit = 50000
enabled_senders =
pushkin.sender.senders.ApnNotificationSender {"workers": 50}
pushkin.sender.senders.GcmNotificationSender {"workers": 50}
[Log]
main_logger_name = pushkin
main_log_path = /var/log/pushkin/
notifications_logger_name = notifications
notification_log_path = /var/log/pushkin/notification/
notification_log_when_to_rotate = H
notification_log_rotate_suffix = %Y-%m-%d_%H
main_log_level = DEBUG
keep_log_days = 7
[Database]
db_host = localhost
db_port = 5432
db_user = pushkin
db_name = pushkin
db_pass = pushkin
db_pool_size = 20
max_devices_per_user = 10
max_users_per_device = 1
[Event]
login_event_id = 4001
turn_off_notification_event_id = 4006
[RequestHandler]
proto_event_handler_url = /post_events_proto
proto_notification_handler_url = /post_notification_proto
json_event_handler_url = /post_events_json
json_notification_handler_url = /post_notification_json
request_queue_handler_url = /get_request_queue
apn_sender_queue_handler_url = /get_apn_sender_queue
gcm_sender_queue_handler_url = /get_gcm_sender_queue
notification_post_processor_queue_handler_url = /get_notification_post_processor_queue
Could someone give me any clue? I'm not experienced with python, maybe it's a simple issue, but I can't figure it out.
Thank you.
I want to use it but I don't know if this is still in development or dead
group of notifications to override
max time of delay
filter per platform and application_version
priority
There are multiple devices with same device token in database
Pushkin should handle unregistered device responses (application removed) and stop sending notifications to these devices.
There are two servlets for json and protobuf messages which URIs are hardcoded.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.