NOTA BENE: Sono l'autore delle due gemme elencate qui sotto.
Se si desidera inviare chiamate HTTP/2, è possibile considerare NetHttp2, un client HTTP/2 per Ruby.
esempio di utilizzo per la sincronizzazione chiama:
require 'net-http2'
# create a client
client = NetHttp2::Client.new("http://106.186.112.116")
# send request
response = client.call(:get, '/')
# read the response
response.ok? # => true
response.status # => '200'
response.headers # => {":status"=>"200"}
response.body # => "A body"
# close the connection
client.close
In cima a scrivere il HTTP/2 chiamate voi stessi, se si vuole una Push Notification gioiello di Apple che utilizza i nuovi/2 specifiche HTTP e può essere integrato in un L'ambiente delle rotaie può anche essere considerato Apnotic.
uso è molto semplice:
require 'apnotic'
# create a persistent connection
connection = Apnotic::Connection.new(cert_path: "apns_certificate.pem", cert_pass: "pass")
# create a notification for a specific device token
token = "6c267f26b173cd9595ae2f6702b1ab560371a60e7c8a9e27419bd0fa4a42e58f"
notification = Apnotic::Notification.new(token)
notification.alert = "Notification from Apnotic!"
# send (this is a blocking call)
response = connection.push(notification)
# read the response
response.ok? # => true
response.status # => '200'
response.headers # => {":status"=>"200", "apns-id"=>"6f2cd350-bfad-4af0-a8bc-0d501e9e1799"}
response.body # => ""
# close the connection
connection.close
tu sei la prima persona che ho sentito che sta cercando di utilizzare HTTP2, buona fortuna, ne avrete bisogno: D – bbozo