@adonisjs/ignitor
Advanced tools
Comparing version 2.0.5 to 2.0.6
@@ -0,1 +1,12 @@ | ||
<a name="2.0.6"></a> | ||
## [2.0.6](https://github.com/adonisjs/adonis-ignitor/compare/v2.0.5...v2.0.6) (2018-03-18) | ||
### Features | ||
* **ignitor:** expose methods to run the Websocket server along with Http ([a39eb17](https://github.com/adonisjs/adonis-ignitor/commit/a39eb17)) | ||
* **Ignitor:** optionally load wsKernel for websocket middleware ([5254f50](https://github.com/adonisjs/adonis-ignitor/commit/5254f50)) | ||
<a name="2.0.5"></a> | ||
@@ -2,0 +13,0 @@ ## [2.0.5](https://github.com/adonisjs/adonis-ignitor/compare/v2.0.4...v2.0.5) (2018-02-08) |
{ | ||
"name": "@adonisjs/ignitor", | ||
"version": "2.0.5", | ||
"version": "2.0.6", | ||
"description": "Fire the adonis-app (in good sense)", | ||
@@ -23,5 +23,5 @@ "main": "index.js", | ||
"devDependencies": { | ||
"@adonisjs/ace": "^4.0.8", | ||
"@adonisjs/fold": "^4.0.5", | ||
"@adonisjs/sink": "^1.0.13", | ||
"@adonisjs/ace": "^5.0.1", | ||
"@adonisjs/fold": "^4.0.7", | ||
"@adonisjs/sink": "^1.0.16", | ||
"clear-require": "^2.0.0", | ||
@@ -33,5 +33,5 @@ "coveralls": "^3.0.0", | ||
"japa-cli": "^1.0.1", | ||
"nyc": "^11.4.1", | ||
"nyc": "^11.6.0", | ||
"semver": "^5.5.0", | ||
"standard": "^10.0.3" | ||
"standard": "^11.0.1" | ||
}, | ||
@@ -38,0 +38,0 @@ "config": { |
@@ -61,3 +61,4 @@ 'use strict' | ||
'start/socket', | ||
'start/kernel' | ||
'start/kernel', | ||
'start/wsKernel' | ||
] | ||
@@ -74,2 +75,3 @@ | ||
'start/kernel', | ||
'start/wsKernel', | ||
'database/factory' | ||
@@ -86,2 +88,10 @@ ] | ||
/** | ||
* Ws server reference to run it | ||
*/ | ||
this._wsServer = { | ||
run: false, | ||
customHttpServer: null | ||
} | ||
/** | ||
* The app namespace registered with resolver | ||
@@ -457,2 +467,9 @@ * for autoloading directories | ||
/** | ||
* Run the Ws server when instructured | ||
*/ | ||
if (this._wsServer.run) { | ||
this._startWsServer(this._wsServer.customHttpServer || Server.getInstance()) | ||
} | ||
/** | ||
* Start the server | ||
@@ -469,2 +486,3 @@ */ | ||
} | ||
this._listenForSigEvents() | ||
@@ -475,2 +493,17 @@ this._callHooks('after', 'httpServer') | ||
/** | ||
* Starts the websocket servers | ||
* | ||
* @method _startWsServer | ||
* | ||
* @param {Http.Server} httpServer | ||
* | ||
* @return {void} | ||
* | ||
* @private | ||
*/ | ||
_startWsServer (httpServer) { | ||
this._fold.ioc.use('Adonis/Addons/Ws').listen(httpServer) | ||
} | ||
/* istanbul ignore next */ | ||
@@ -521,4 +554,13 @@ /** | ||
process.on('SIGTERM', () => { | ||
debug('Gracefully stopping http server') | ||
/** | ||
* Also close the ws server | ||
*/ | ||
if (this._wsServer.run) { | ||
const Ws = this._fold.ioc.use('Adonis/Addons/Ws') | ||
Ws.close() | ||
} | ||
const Server = this._fold.ioc.use('Adonis/Src/Server') | ||
debug('Gracefully stopping http server') | ||
Server.close(process.exit) | ||
@@ -729,2 +771,19 @@ }) | ||
/** | ||
* This method will instruct ignitor to run | ||
* the websocket server along with the | ||
* http server | ||
* | ||
* @method wsServer | ||
* | ||
* @param {Http.Server} [httpServer] | ||
* | ||
* @chainable | ||
*/ | ||
wsServer (httpServer = null) { | ||
this._wsServer.run = true | ||
this._wsServer.customHttpServer = httpServer | ||
return this | ||
} | ||
/** | ||
* Starts the Adonis http server. | ||
@@ -731,0 +790,0 @@ * |
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
39958
1092