Skip to content
Snippets Groups Projects
Commit 8bb11e0a authored by Diego Sampaio's avatar Diego Sampaio
Browse files

using REST to send pushes through gateway

parent b0ea38ca
No related branches found
No related tags found
No related merge requests found
......@@ -82,8 +82,6 @@ configurePush = ->
sendBatchSize: 10
if RocketChat.settings.get('Push_enable_gateway') is true
pushGetway = undefined
Push.serverSend = (options) ->
options = options or { badge: 0 }
query = undefined
......@@ -116,12 +114,16 @@ configurePush = ->
console.log('send to token', app.token)
if app.token.apn?
pushGetway.call 'sendPushNotification', 'apn', app.token.apn, options
service = 'apn'
token = app.token.apn
else if app.token.gcm?
pushGetway.call 'sendPushNotification', 'gcm', app.token.gcm, options
service = 'gcm'
token = app.token.gcm
pushGetway = DDP.connect(RocketChat.settings.get('Push_gateway'), {_dontPrintErrors: false})
HTTP.post RocketChat.settings.get('Push_gateway') + "/push/#{service}/send",
data:
token: token
options: options
Push.enabled = true
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment