Giter Site home page Giter Site logo

pushkin's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pushkin's Issues

Implement cleanup functionality for users and devices

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).

Alembic error: Can't locate revision identified by '34dd0bf00472'

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'

Implement time to live (TTL) for notifications

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.

Error while logging some notifications

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)

Params (or pairs) on post_notification_json endpoint

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

Limit login ids per device

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.

Pushkin on docker

Hi,

Could you provide an example of Dockerfile setup for pushkin?

iOs issue, Connection to APN lost

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]

Name of your application

game = PromoGo

Id of pushkin instance

world_id = 1

Default API port

port = 8887

[Messenger]

if true, gcm clients will not receive notifications

dry_run = false

max batch size for apn notifications

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$

for future use

apns_sandbox = false
connection_error_retries = 3

Baselink for your application sent with push notifications

base_deeplink_url = application_name.com

[RequestProcessor]

queue limit for requests processor. See Monitoring API for reference

queue_limit = 50000

Number of threads for request processor

request_processor_num_threads = 10

[Sender]

queue limit for sender processor. See Monitoring API for reference

sender_queue_limit = 50000

enabled_senders =
pushkin.sender.senders.ApnNotificationSender {"workers": 50}
pushkin.sender.senders.GcmNotificationSender {"workers": 50}

[Log]

log configuration

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

notset, debug, info, warning, error, critical

main_log_level = DEBUG
keep_log_days = 7

[Database]

database credentials

to use unix socket set this to socket directory path

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]

event id of prebuilt login event

login_event_id = 4001
turn_off_notification_event_id = 4006

[RequestHandler]

URLs for all request handlers

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.

Handle unregistered devices

Pushkin should handle unregistered device responses (application removed) and stop sending notifications to these devices.

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.