Move async work out of the Server constructor

Summary:
I feel like doing async stuff here isn't a good idea in general.
But more pressingly, it means you can't immediately call server.close() after new Server(), because the things to close haven't been created yet.

Reviewed By: danielbuechele

Differential Revision: D10488301

fbshipit-source-id: 76ebe91e0c09f353e0bdb9f2e4116757e757abb2
This commit is contained in:
John Knox
2018-10-22 11:36:06 -07:00
committed by Facebook Github Bot
parent 086ab0188b
commit 764cdfe127
3 changed files with 18 additions and 7 deletions

View File

@@ -13,6 +13,7 @@ import type Client from '../Client.js';
export default (store: Store, logger: Logger) => {
const server = new Server(logger, store);
server.init();
server.addListener('new-client', (client: Client) => {
store.dispatch({