Skip to content

Instantly share code, notes, and snippets.

@rvacoder
Created February 21, 2014 19:31
Show Gist options
  • Save rvacoder/9141665 to your computer and use it in GitHub Desktop.
Save rvacoder/9141665 to your computer and use it in GitHub Desktop.
Usando $rootScope
Para activar PUBNUB en el SPA primero dar clic sobre el boton Alertas,
esto será cambiado al momento de hacer login.
Se cambia el uso de $scope.accounts a $rootScope.accounts para mantenerlos siempre compartidos
desde cualquier $scope y asi puedan ser accedidos desde cualquier controlador. Se omite el uso del
servicio compartido
Para enviar un mensaje al SPA
http://www.pubnub.com/console/
channel: my_channel_anzen666_common
subscribe_key: sub-c-74d472c2-894a-11e3-a56b-02ee2ddab7fe
publish_key: pub-c-d49c709c-8d0c-40ed-aaa6-66cbc20683d0
enviar el json
{
"messageType": "transaction",
"user": {
"bankID": "1",
"login": "testlogin"
},
"transaction": {
"transactionID": "1",
"origin": "origin",
"target": "target",
"createdAt": 1022729410000,
"amount": 12.31,
"currency": "MXN",
"location": {
"coordinates": {
"lng": 0.1,
"lat": 0.2
},
"zip": "zip",
"state": "state",
"city": "city",
"address": "adress",
"name": "name"
},
"folio": 1,
"type": "type",
"description": "description test",
"reference": "ref"
},
"account": {
"accountID": "accountID",
"balance": 30
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment