Comments (4)
you cannot do a manual closing because of the way trio is designed, all your code has to be in a with: block with the nursery to keep the background tasks alive and in-scope.
what you can do is use the less sugary API so that you can manage the trio nursery yourself, and put your whole script in a nursery.
from pypush.
probably the best way to make this clear is to just have your class have it's own async context manager, that way your users are aware that it needs to keep a connection open the whole time
it makes forgetting .close impossible, which means you can guarantee you do anything you need to do on shutdown
it makes it possible to use the nursery to schedule background notification handlers etc.
from pypush.
like what you would do is basically do what start's asynccontextmanager does, except you put the with APNSConnection.start block in there and inside that yield your own class instead of APNSConnection
from pypush.
The workaround I did is save push creds into the class attributes, and then open a connection with them each time I need it inside a class's method. Should do the job for now !
from pypush.
Related Issues (20)
- Relicense to a free license HOT 1
- No exception thrown if X64 slice is not found HOT 2
- Unable to find the public key of the sender, cannot verify HOT 1
- Trademark compliance
- Apple 2FA not supported? HOT 10
- SSPL License Issues HOT 9
- Validation data expired HOT 18
- No cert in response HOT 6
- demo stuck in Waiting for incoming messages HOT 7
- No learning documentation HOT 2
- messages failing to deliver
- Validation data expired!
- Participant identities being mistaken as fake accounts HOT 28
- Cat and Mouse? HOT 3
- No sending message (WARNING about his is probably not a real account) HOT 7
- I sent a message, but there was no response,and then I type anything but not works and I can't exit
- has been no response. HOT 18
- In the sync branch, can I set up a proxy for use? ? ?
- install issue
- 我愿意付费或雇佣寻找能够开发维护的人 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pypush.