Connecting

    1. A ‘NATS URL’ which is a string (in a URL format) that specifies the IP address and port where the NATS server(s) can be reached, and what kind of connection to establish:
      • Plain un-encrypted TCP connection (i.e. NATS URLs starting with )
      • TLS encrypted TCP connection (i.e. NATS URLs starting with )

    Note that when connecting to a NATS service infrastructure with clusters there is more than one URL and the application should allow for more than one URL to be specified in its NATS connect call (typically you pass a comma separated list of URLs as the URL, e.g. ).

    When connecting to a cluster it is best to provide the complete set of ‘seed’ URLs for the cluster.

    1. If required: authentication details for the application to identify itself with the NATS server(s). NATS supports multiple authentication schemes:
      • Username/Password credentials (which can be passed as part of the NATS URL)
      • (where the application is configured with the location of ‘credentials file’ containing the JWT and private Nkey)
      • Token Authentication (where the application is configured with a Token string)
      • (where the client is configured with a Seed and User NKeys)

    Runtime configuration

    Besides the connectivity and security details, there are numerous options for a NATS connection ranging from to reconnect settings to setting in your application.

    WebSocket and NATS

    NATS WebSockets and React

    {% embed url=”https://www.youtube.com/watch?v=XS_Q0i6orSk“ %} NATS WebSockets and React {% endembed %}