You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.
Now buford provides the function of push.NewClient(cert tls.Certifcate) (*http.Client, error) for creating a http/2 client.
client, err:=push.NewClient(certificate)
But push.NewClient() can not customize http.Transport like the code below for a http/2 client.
// example definitiontransport:=&http.Transport{
TLSClientConfig: config,
MaxIdleConnsPerHost: 16,
}
MaxIdleConnsPerHost is important for sending many notifications to APNs once. Accoding to the document below (Best Practices for Managing Connections), increasing connections to APNs seems to be recommended for improving performance. (MaxIdleConnsPerHost is 2 by default. )
Thanks for mentioning the MaxIdleConnsPerHost consideration.
I'm not sure that it's really necessary to add a function for Buford to customize transport, or what it would look like if I did. You can easily copy/paste and modify these 10 lines of code to create your own HTTP client that you pass to push.NewService.
// NewClient sets up an HTTP/2 client for a certificate.funcNewClient(cert tls.Certificate) (*http.Client, error) {
config:=&tls.Config{
Certificates: []tls.Certificate{cert},
}
config.BuildNameToCertificate()
transport:=&http.Transport{TLSClientConfig: config}
iferr:=http2.ConfigureTransport(transport); err!=nil {
returnnil, err
}
return&http.Client{Transport: transport}, nil
}
Now buford provides the function of
push.NewClient(cert tls.Certifcate) (*http.Client, error)
for creating a http/2 client.But
push.NewClient()
can not customizehttp.Transport
like the code below for a http/2 client.MaxIdleConnsPerHost
is important for sending many notifications to APNs once. Accoding to the document below (Best Practices for Managing Connections), increasing connections to APNs seems to be recommended for improving performance. (MaxIdleConnsPerHost
is 2 by default. )https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/APNsProviderAPI.html#//apple_ref/doc/uid/TP40008194-CH101-SW1
Though it is good if there is the function for customizing
http.Transport
for a http/2 client, what do you think?The text was updated successfully, but these errors were encountered: