configureServer method

Future configureServer(
  1. Angel app
)

Configures an Angel instance to listen for WebSocket connections.

Implementation

Future configureServer(Angel app) async {
  app.container.registerSingleton(this);

  if (runtimeType != AngelWebSocket) {
    app.container.registerSingleton<AngelWebSocket>(this);
  }

  // Set up services
  wireAllServices(app);

  app.onService.listen((_) {
    wireAllServices(app);
  });

  if (synchronizationChannel != null) {
    synchronizationChannel?.stream
        .listen((e) => batchEvent(e, notify: false));
  }

  app.shutdownHooks.add((_) => synchronizationChannel?.sink.close());
}