Renamed the `gateway` config parameter to `address`
There has been some confusion around the parameter naming between the Notification and the Feedback side of the module. The `gateway` parameter has been replaced with `address`. Backwards compatibility remains with the `gateway` parameter which will take precedence if present.
This commit is contained in:
Родитель
a374885c7b
Коммит
1bba8db41f
|
@ -41,7 +41,7 @@ Options:
|
|||
|
||||
- `passphrase` {String} The passphrase for the connection key, if required
|
||||
|
||||
- `gateway` {String `gateway.push.apple.com`} The gateway server to connect to.
|
||||
- `address` {String `gateway.push.apple.com`} The gateway server to connect to.
|
||||
|
||||
- `port` {Number} Gateway port (Defaults to: `2195`)
|
||||
|
||||
|
@ -63,7 +63,7 @@ Options:
|
|||
|
||||
- `legacy` {Boolean} Whether to use the pre-iOS 7 protocol format. (Defaults to `false`)
|
||||
|
||||
**Important:** In a development environment you must set `gateway` to `gateway.sandbox.push.apple.com`.
|
||||
**Important:** In a development environment you must set `address` to `gateway.sandbox.push.apple.com`.
|
||||
|
||||
## apn.Feedback([options])
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ if(process.env.DEBUG) {
|
|||
* @config {String} [pfx] File path for private key, certificate and CA certs in PFX or PKCS12 format. If supplied will be used instead of certificate and key above
|
||||
* @config {Buffer|String} [pfxData] PFX or PKCS12 format data containing the private key, certificate and CA certs. If supplied will be used instead of loading from disk.
|
||||
* @config {String} [passphrase] The passphrase for the connection key, if required
|
||||
* @config {String} [gateway="gateway.push.apple.com"] The gateway server to connect to.
|
||||
* @config {String} [address="gateway.push.apple.com"] The gateway server to connect to.
|
||||
* @config {Number} [port=2195] Gateway port
|
||||
* @config {Boolean} [rejectUnauthorized=true] Reject Unauthorized property to be passed through to tls.connect()
|
||||
* @config {Boolean} [enhanced=true] Whether to use the enhanced notification format (recommended)
|
||||
|
@ -57,7 +57,7 @@ function Connection (options) {
|
|||
pfx: null,
|
||||
pfxData: null,
|
||||
passphrase: null,
|
||||
gateway: 'gateway.push.apple.com',
|
||||
address: 'gateway.push.apple.com',
|
||||
port: 2195,
|
||||
rejectUnauthorized: true,
|
||||
enhanced: true,
|
||||
|
@ -190,7 +190,7 @@ Connection.prototype.connect = function () {
|
|||
|
||||
this.socket = tls.connect(
|
||||
this.options['port'],
|
||||
this.options['gateway'],
|
||||
this.options['gateway'] || this.options['address'],
|
||||
socketOptions,
|
||||
function () {
|
||||
debug("Connection established");
|
||||
|
@ -212,10 +212,10 @@ Connection.prototype.connect = function () {
|
|||
// The actual connection is delayed until after all the event listeners have
|
||||
// been attached.
|
||||
if ("function" == typeof this.socket.connect ) {
|
||||
this.socket.connect(this.options['port'], this.options['gateway']);
|
||||
this.socket.connect(this.options['port'], this.options['gateway'] || this.options['address']);
|
||||
}
|
||||
else {
|
||||
socketOptions.socket.connect(this.options['port'], this.options['gateway']);
|
||||
socketOptions.socket.connect(this.options['port'], this.options['gateway'] || this.options['address']);
|
||||
}
|
||||
}.bind(this)).fail(function (error) {
|
||||
debug("Module initialisation error:", error);
|
||||
|
|
Загрузка…
Ссылка в новой задаче