Git Product home page Git Product logo

e-apns's Introduction

e-apns

erlang server for APNS

for more info about APNS check this building

build the project by compiling all source code:

		$ make e-apns

configuring

configure the config file under priv directory, setting all parameters to valid params:

	- address_apns:		address for APNS server
	- port_apns:		port for APNS server
	- certfile_apns:	certificate file (created from .cer file)(you can use .pem from dev center)
	- keyfile_apns:		key file (created from .p12 file)(you can use .pem from dev center)
	- password_apns:	password for connect to APNS server 
	- timeout_apns:		max time for waiting a valid connection to APNS server

NOTE: files cert and key could be generated with openssl.

using

To start the e-apns from an erlang shell just start with the correct path:

		$ erl -pa path/to/e-apns/ebin

In the erlang shell start the application:

		> application:start('e-apns').
		I(<0.50.0>) [e-apns] apns initialized

NOTE: you must start crypto, public_key and ssl before start e-apns.

connecting to APNS

Connecting to APNS is easy, just type:

		> {ok, Resource} = 'e-apns':get_resource_apns().
		{ok,{ok,{sslsocket,new_ssl,<0.??.0>},<0.??.0>}}

Resource variable is used to send a message or receive apns messages over ssl socket.

sending message to a device

To send a message you need some parameters like:

	- Token (device id)
	- The payload, in this case the structure for the payload is: {Msg, Sound, Badge}
	- Expiry
	- Identifier
	- The Resource (got with get_resource_apns)

Send a message using 'push_apns' function:

		> 'e-apns':push_apns(Resource, 1, 1000, "DeviceId", {"Hello", "alert", "10"}).
		ok

this could be send the message "Hello" to the device with id = "DeviceId"

license

see LICENSE.txt for more info

e-apns's People

Contributors

zgbjgg avatar

Stargazers

JhonLiu avatar

Watchers

 avatar JhonLiu avatar

Forkers

ondevdhineshk

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.