diff --git a/lib/apnagent/message.js b/lib/apnagent/message.js index 2e74e35..f2a8282 100644 --- a/lib/apnagent/message.js +++ b/lib/apnagent/message.js @@ -407,8 +407,8 @@ Message.prototype.serialize = function () { var str = JSON.stringify(payload) , len = Buffer.byteLength(str, enc); - if (len > 256 && this.aps.body) { - var over = len - 256 + if (len > 2048 && this.aps.body) { + var over = len - 2048 , bodyLen = Buffer.byteLength(this.aps.body, enc) , body = bodyLen <= over ? null @@ -423,7 +423,7 @@ Message.prototype.serialize = function () { } else { payload.aps.alert.body = body; } - } else if (len > 256) { + } else if (len > 2048) { throw new SE('Message too long.', null, ssf); } diff --git a/test/message.js b/test/message.js index 2777f3a..ecad26f 100644 --- a/test/message.js +++ b/test/message.js @@ -167,7 +167,7 @@ describe('Message', function () { var json = msg.serialize(); Buffer.byteLength(JSON.stringify(json.payload), msg.encoding) - .should.not.be.above(256); + .should.not.be.above(2048); json.payload.should.deep.equal({ custom: 'variable' @@ -192,7 +192,7 @@ describe('Message', function () { var json = msg.serialize(); Buffer.byteLength(JSON.stringify(json.payload), msg.encoding) - .should.not.be.above(256); + .should.not.be.above(2048); json.payload.should.deep.equal({ custom: 'variable' @@ -230,7 +230,7 @@ describe('Message', function () { var json = msg.serialize(); Buffer.byteLength(JSON.stringify(json.payload), msg.encoding) - .should.not.be.above(256); + .should.not.be.above(2048); json.payload.should.deep.equal({ custom: 'variable' @@ -259,7 +259,7 @@ describe('Message', function () { var json = msg.serialize(); Buffer.byteLength(JSON.stringify(json.payload), msg.encoding) - .should.not.be.above(256); + .should.not.be.above(2048); json.payload.should.deep.equal({ custom: 'variable' @@ -287,7 +287,7 @@ describe('Message', function () { var json = msg.serialize(); Buffer.byteLength(JSON.stringify(json.payload), msg.encoding) - .should.not.be.above(256); + .should.not.be.above(2048); json.payload.should.deep.equal({ custom: 'variable' @@ -319,7 +319,7 @@ describe('Message', function () { var json = msg.serialize(); Buffer.byteLength(JSON.stringify(json.payload), msg.encoding) - .should.not.be.above(256); + .should.not.be.above(2048); json.payload.should.deep.equal({ custom: 'variable'