Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nc.connect() API #600

Open
swelborn opened this issue Aug 12, 2024 · 1 comment · May be fixed by #610
Open

nc.connect() API #600

swelborn opened this issue Aug 12, 2024 · 1 comment · May be fixed by #610
Assignees
Labels
accepted The defect or proposal as been accepted good first issue Good for newcomers proposal Enhancement idea or proposal

Comments

@swelborn
Copy link

swelborn commented Aug 12, 2024

Proposed change

Connect options are currently not documented, other than source code.

    async def connect(
        self,
        servers: Union[str, List[str]] = ["nats://localhost:4222"],
        error_cb: Optional[ErrorCallback] = None,
        disconnected_cb: Optional[Callback] = None,
        closed_cb: Optional[Callback] = None,
        discovered_server_cb: Optional[Callback] = None,
        reconnected_cb: Optional[Callback] = None,
        name: Optional[str] = None,
        pedantic: bool = False,
        verbose: bool = False,
        allow_reconnect: bool = True,
        connect_timeout: int = DEFAULT_CONNECT_TIMEOUT,
        reconnect_time_wait: int = DEFAULT_RECONNECT_TIME_WAIT,
        max_reconnect_attempts: int = DEFAULT_MAX_RECONNECT_ATTEMPTS,
        ping_interval: int = DEFAULT_PING_INTERVAL,
        max_outstanding_pings: int = DEFAULT_MAX_OUTSTANDING_PINGS,
        dont_randomize: bool = False,
        flusher_queue_size: int = DEFAULT_MAX_FLUSHER_QUEUE_SIZE,
        no_echo: bool = False,
        tls: Optional[ssl.SSLContext] = None,
        tls_hostname: Optional[str] = None,
        tls_handshake_first: bool = False,
        user: Optional[str] = None,
        password: Optional[str] = None,
        token: Optional[str] = None,
        drain_timeout: int = DEFAULT_DRAIN_TIMEOUT,
        signature_cb: Optional[SignatureCallback] = None,
        user_jwt_cb: Optional[JWTCallback] = None,
        user_credentials: Optional[Credentials] = None,
        nkeys_seed: Optional[str] = None,
        nkeys_seed_str: Optional[str] = None,
        inbox_prefix: Union[str, bytes] = DEFAULT_INBOX_PREFIX,
        pending_size: int = DEFAULT_PENDING_SIZE,
        flush_timeout: Optional[float] = None,
    ) -> None:
 

It would be nice to have these as a ConnectOptions class.

Use case

Ease of use.

Contribution

potentially!

@swelborn swelborn added the proposal Enhancement idea or proposal label Aug 12, 2024
@caspervonb
Copy link
Contributor

This was brought up in slack as-well, PR welcome.

@caspervonb caspervonb added accepted The defect or proposal as been accepted good first issue Good for newcomers labels Sep 24, 2024
@swelborn swelborn linked a pull request Sep 24, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted The defect or proposal as been accepted good first issue Good for newcomers proposal Enhancement idea or proposal
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants