getOptions function

ClientOptions getOptions([
  1. ClientOptions? defaultOptions
])

Get the options to pass to the INyxxFactory.createNyxxWebsocket constructor when instanciating nyxx. Only for use in spawned processes.

defaultOptions can be provided to specify defaults for other options in ClientOptions. This function overrides ClientOptions.shardCount and ClientOptions.shardIds, so their values will be ignored.

Calling this function in a process that was not spawned by nyxx_sharding will throw a ShardingError.

Implementation

ClientOptions getOptions([ClientOptions? defaultOptions]) {
  defaultOptions ??= ClientOptions();

  defaultOptions
    ..shardCount = totalShards
    ..shardIds = shardIds;

  return defaultOptions;
}