onAuthorizer method

Authorizer onAuthorizer(
  1. Channel channel,
  2. AuthorizerOptions options
)

Implementation

Authorizer onAuthorizer(Channel channel, AuthorizerOptions options) {
  return Authorizer(
    authorize: allowInterop((socketId, callback) async {
      try {
        var authData = await methodChannel!.invokeMethod('onAuthorizer', {
          'socketId': socketId,
          'channelName': channel.name,
          'options': options.toMap(),
        });
        callback(
            null,
            AuthData(
                auth: authData['auth'],
                channel_data: authData['channel_data'],
                shared_secret: authData['shared_secret']));
      } catch (e) {
        callback(PusherError(e.toString(), -1), AuthData(auth: ''));
      }
    }),
  );
}