File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,20 @@ if res.Sent() {
124
124
}
125
125
```
126
126
127
+ ## Context & Timeouts
128
+
129
+ For better control over request cancelations and timeouts APNS/2 supports
130
+ contexts. Using a context can be helpful if you want to cancel all pushes when
131
+ the parent process is cancelled, or need finer grained control over individual
132
+ push timeouts. See the [ Google post] ( https://blog.golang.org/context ) for more
133
+ information on contexts.
134
+
135
+ ``` go
136
+ ctx, cancel = context.WithTimeout (context.Background (), 10 * time.Second )
137
+ res , err := client.PushWithContext (ctx, notification)
138
+ defer cancel ()
139
+ ```
140
+
127
141
## Command line tool
128
142
129
143
APNS/2 has a command line tool that can be installed with ` go get github.com/sideshow/apns2/apns2 ` . Usage:
You can’t perform that action at this time.
0 commit comments