initServer static method

Server initServer(
  1. TelepactSchema schema,
  2. Future<Message> handler(
    1. Message im
    ),
  3. ServerOptions options
)

Initializes the server with the schema, handler function, and options.

Implementation

static b.Server initServer(b.TelepactSchema schema,
    Future<Message> Function(Message im) handler, ServerOptions options) {
  JSPromise outerHandler(b.Message om) {
    final m = Message.fromJS(om);
    return handler(m).then((response) {
      return response._message;
    }).toJS;
  }

  return b.Server(schema, outerHandler.toJS, options._options);
}