You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ember-cli server task passes options to each middleware, but currently it is not possible for middleware to get access to the http server instance (in fact it is created after the server middleware is initialized)
This makes it difficult to setup mocks that initialize a ws.Server to provide a web socket service.
Changing ExpressServer.start to this seems to work without issue for me:
start: function(options) {
var ui = this.ui;
this.app = require('express')();
this.setupHttpServer();
options.project = this.project;
options.watcher = this.watcher;
options.ui = this.ui;
options.httpServer = this.httpServer
this.processAppMiddlewares(options);
this.processAddonMiddlewares(options);
return this.listen(options.port, options.host)
.then(function() {
ui.writeLine('Serving on http://' + options.host + ':' + options.port);
})
.catch(function() {
throw new SilentError('Could not serve on http://' + options.host + ':' + options.port + '. It is either in use or you do not have permission.');
});
}
I just have to modify my mocks/index.js in my project to pass the options on to my individual middleware functions.
Is there an example of a better way to do web socket mocks anywhere else? Or a way to extend/reopen/override default tasks like ExpressServer?
The text was updated successfully, but these errors were encountered:
This change seems perfectly fine with me. Please submit a PR (with a test that confirms httpServer is present in the options passed through to the middlewares).
The ember-cli server task passes options to each middleware, but currently it is not possible for middleware to get access to the http server instance (in fact it is created after the server middleware is initialized)
This makes it difficult to setup mocks that initialize a ws.Server to provide a web socket service.
Changing ExpressServer.start to this seems to work without issue for me:
I just have to modify my mocks/index.js in my project to pass the options on to my individual middleware functions.
Is there an example of a better way to do web socket mocks anywhere else? Or a way to extend/reopen/override default tasks like ExpressServer?
The text was updated successfully, but these errors were encountered: