twilio-notifications
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -48,6 +48,9 @@ 'use strict'; | ||
this._twilsock.on('message', (type, message) => this._routeMessage(type, message)); | ||
this._registrar.on('transportReady', state => this.emit('transportReady', state)); | ||
this._registrar.on('stateChanged', (state) => { this._onRegistrationStateChange(state); }); | ||
this._registrar.on('needReliableTransport', this._onNeedReliableTransport.bind(this)); | ||
this._twilsock.on('message', (type, message) => this._routeMessage(type, message)); | ||
this._twilsock.on('connected', (notificationId) => { | ||
@@ -92,5 +95,9 @@ this._onTransportStateChange(true); | ||
&& this._reliableTransportState.registration; | ||
console.log('Overall state ', overallState); | ||
if (this._reliableTransportState.overall !== overallState) { | ||
this._reliableTransportState.overall = overallState; | ||
console.log(' -- Overall state ', overallState); | ||
log.info('NTFCN I: Transport ready ' + overallState); | ||
@@ -97,0 +104,0 @@ this.emit('transportReady', overallState); |
@@ -23,5 +23,9 @@ 'use strict'; | ||
.substring(0, 128); | ||
this._connectors.set('twilsock', new TwilsockConnector({ productId, platform }, twilsock, config)); | ||
this._connectors.set('gcm', new ErsConnector({ productId, platform }, transport, config, 'gcm')); | ||
this._connectors.get('twilsock') | ||
.on('transportReady', state => this.emit('transportReady', state)); | ||
EventEmitter.call(this); | ||
@@ -28,0 +32,0 @@ } |
'use strict'; | ||
const EventEmitter = require('events').EventEmitter; | ||
const inherits = require('util').inherits; | ||
const uuid = require('uuid'); | ||
@@ -25,6 +28,17 @@ const log = require('loglevel'); | ||
_messageTypes: { value: new Set() }, | ||
config: { value: config }, | ||
context: { value: context } | ||
}); | ||
twilsock.on('disconnected', () => this.emit('transportReady', false)); | ||
twilsock.on('registered', id => { | ||
if (context && id === context.id) { | ||
this.emit('transportReady', true); | ||
} | ||
}); | ||
EventEmitter.call(this); | ||
} | ||
inherits(TwilsockConnector, EventEmitter); | ||
@@ -31,0 +45,0 @@ TwilsockConnector.prototype.setNotificationId = function() { |
{ | ||
"name": "twilio-notifications", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Client library for Twilio Notifications service", | ||
"main": "lib/client.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/twilio/twilio-notifications.js" | ||
}, | ||
"scripts": { | ||
@@ -16,3 +20,3 @@ "test": "gulp unit-test" | ||
"twilio-transport": "0.0.1", | ||
"twilsock": "0.1.0", | ||
"twilsock": "0.1.1", | ||
"uuid": "^2.0.2" | ||
@@ -19,0 +23,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
222514
1213
0
+ Addedtwilsock@0.1.1(transitive)
- Removedtwilsock@0.1.0(transitive)
Updatedtwilsock@0.1.1