Copyright © Inaka <hello@inaka.net>
Behaviours: gen_server.
This gen_server handles the APNs Connection.
Copyright 2017 Erlang Solutions Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.connection() = #{name := name(), apple_host := host(), apple_port := inet:port_number(), certfile => path(), keyfile => path(), timeout => integer(), type := type()}
host() = string() | inet:ip_address()
name() = atom()
notification() = binary()
path() = string()
state() = #{connection := connection(), http2_connection := pid(), client := pid(), backoff := non_neg_integer(), backoff_ceiling := non_neg_integer()}
type() = cert | token
certfile/1 | |
close_connection/1 | Close the connection with APNs gracefully. |
code_change/3 | |
default_connection/2 | Builds a connection() map from the environment variables. |
handle_call/3 | |
handle_cast/2 | |
handle_info/2 | |
host/1 | |
http2_connection/1 | Returns the http2's connection PID. |
init/1 | |
keyfile/1 | |
name/1 | |
port/1 | |
push_notification/4 | Pushes notification to certificate APNs connection. |
push_notification/5 | Pushes notification to certificate APNs connection. |
start_link/2 | starts the gen_server. |
terminate/2 | |
type/1 |
certfile(X1::connection()) -> path()
close_connection(ConnectionId::name() | pid()) -> ok
Close the connection with APNs gracefully
code_change(OldVsn::term() | {down, term()}, State, Extra::term()) -> {ok, State}
default_connection(X1::type(), ConnectionName::name()) -> connection()
Builds a connection() map from the environment variables.
handle_call(Request::term(), From::{pid(), term()}, State) -> {reply, ok, State}
handle_cast(Request::term(), State) -> {noreply, State}
handle_info(Info::timeout() | term(), State) -> {noreply, State}
host(X1::connection()) -> host()
http2_connection(ConnectionId::name() | pid()) -> pid()
Returns the http2's connection PID. This function is only used in tests.
init(X1::{connection(), pid()}) -> {ok, State::state()}
keyfile(X1::connection()) -> path()
name(X1::connection()) -> name()
port(X1::connection()) -> inet:port_number()
push_notification(ConnectionId::name() | pid(), DeviceId::apns:device_id(), Notification::notification(), Headers::apns:headers()) -> apns:response()
Pushes notification to certificate APNs connection.
push_notification(ConnectionId::name() | pid(), Token::apns:token(), DeviceId::apns:device_id(), Notification::notification(), Headers::apns:headers()) -> apns:response()
Pushes notification to certificate APNs connection.
start_link(Connection::connection(), Client::pid()) -> {ok, Pid::pid()} | ignore | {error, Reason::term()}
starts the gen_server
terminate(Reason::normal | shutdown | {shutdown, term()} | term(), State::state()) -> ok
type(X1::connection()) -> type()
Generated by EDoc, Jun 22 2017, 08:43:28.