apns (apns v2.6.0)
Main module for apns4erl API. Use this one from your own applications.
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.
Summary
Functions
Closes the connection with APNs service.
Connects to APNs service
Connects to APNs service with Provider Certificate or Token
Get the default headers from environment variables.
Push notification to APNs. It will use the headers provided on the environment variables.
Push notification to certificate APNs Connection.
Push notification to APNs with authentication token. It will use the headers provided on the environment variables.
Push notification to authentication token APNs Connection.
Used when starting the application on the shell.
Stops the Application
Wait for the APNs connection to be up.
Types
device_id/0
-type device_id() :: binary().
headers/0
json/0
response/0
token/0
-type token() :: binary().
Functions
close_connection(ConnectionId)
-spec close_connection(apns_connection:name() | pid()) -> ok.
Closes the connection with APNs service.
connect(Connection)
-spec connect(apns_connection:connection()) -> {ok, pid()}.
Connects to APNs service
connect(Type, ConnectionName)
-spec connect(apns_connection:type(), apns_connection:name()) -> {ok, pid()}.
Connects to APNs service with Provider Certificate or Token
default_headers()
-spec default_headers() -> apns:headers().
Get the default headers from environment variables.
generate_token(TeamId, KeyId)
generate_token(TeamId, KeyId, KeyPath)
get_feedback()
-spec get_feedback() -> [apns_feedback:feedback()] | {error, term()} | timeout.
get_feedback(Config)
-spec get_feedback(apns_feedback:feedback_config()) -> [apns_feedback:feedback()] | {error, term()} | timeout.
push_notification(ConnectionId, DeviceId, JSONMap)
-spec push_notification(apns_connection:name() | pid(), device_id(), json()) -> response() | {error, not_connection_owner}.
Push notification to APNs. It will use the headers provided on the environment variables.
push_notification(ConnectionId, DeviceId, JSONMap, Headers)
-spec push_notification(apns_connection:name() | pid(), device_id(), json(), headers()) -> response() | {error, not_connection_owner}.
Push notification to certificate APNs Connection.
push_notification_token(ConnectionId, Token, DeviceId, JSONMap)
-spec push_notification_token(apns_connection:name() | pid(), token(), device_id(), json()) -> response() | {error, not_connection_owner}.
Push notification to APNs with authentication token. It will use the headers provided on the environment variables.
push_notification_token(ConnectionId, Token, DeviceId, JSONMap, Headers)
-spec push_notification_token(apns_connection:name() | pid(), token(), device_id(), json(), headers()) -> response() | {error, not_connection_owner}.
Push notification to authentication token APNs Connection.
start()
-spec start() -> ok.
Used when starting the application on the shell.
stop()
-spec stop() -> ok.
Stops the Application
wait_for_connection_up(Server)
-spec wait_for_connection_up(pid()) -> ok.
Wait for the APNs connection to be up.