Hi Leonel,

Thank you for your answer.

While I was waiting for an answer to my problem I implemented a solution 
very similar to yours. But I have that code (similar to yours) inside a 
thread to avoid its slow performance.

The problem is, as I tell here, in other post 
(https://groups.google.com/forum/#!topic/web2py/LIO5xU3pjyM), that I don't 
know how to use DAL inside a thread because I always get crashes or errors 
due to closed connections in main thread.

So, I will need to know how to use DAL inside a thread or to know how to 
use feedback class of APNSWrapper.

Thanks again and kind regards!

On Sunday, July 6, 2014 8:05:08 PM UTC+2, Leonel Câmara wrote:
>
> I have used PyAPNS https://github.com/simonwhitaker/PyAPNs for this with 
> some degree of success in the past.
>
> What I do is to send the notifications 1 by 1 which is quite slow but at 
> least you can catch invalid tokens. This is the relevant part of the code I 
> use:
>
>     for device in ios_devices:
>         try:
>             apns.gateway_server.send_notification(device, payload)
>         except socket.error as e:
>             # Most likely cause of a broken pipe is this token being 
> invalid! (maybe the user uninstalled)
>             apns = APNs(use_sandbox=False, cert_file=cert, key_file=key)
>             logger.debug('SOCKET ERROR - ' + str(e.errno) + ' deleting ' + 
> device)
>             db((db.push_devices.platform == 'ios') & 
> (db.push_devices.device_id_or_token == device)).delete()
>             continue
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to