1
0
mirror of https://github.com/taigrr/nats.docs synced 2025-01-18 04:03:23 -08:00

updating docs

This commit is contained in:
ainsley
2019-05-31 17:30:03 -05:00
parent 3dcc908390
commit 9891bd5fc1
155 changed files with 1609 additions and 159 deletions

View File

@@ -17,6 +17,11 @@
<label for="connect_creds_js" class="api-lang" data-language="js">JavaScript</label>
<input type="radio" id="connect_creds_py" name="connect_creds" class="tab">
<label for="connect_creds_py" class="api-lang" data-language="py">Python</label>
<input type="radio" id="connect_creds_ts" name="connect_creds" class="tab">
<label for="connect_creds_ts" class="api-lang" data-language="ts">TypeScript</label>
@@ -56,6 +61,24 @@ let nc = NATS.connect({
url: server.nats,
userCreds: credsFile
});
</code></pre>
</div>
<div class="tab__content">
<pre id="connect_creds_py_content"><a class="toolbar-icons pull-right" target="_blank" href="https://github.com/nats-io/asyncio-nats-examples/blob/master/connect_creds.py#L5-20"><i class="mdi mdi-github-circle" title="View on GitHub"></i></a><a class="toolbar-icons pull-right"><i class="mdi mdi-content-copy js-copy" title="Copy to Clipboard"></i></a><span class="copy-msg pull-right"></span><code class="language-python">nc = NATS()
async def error_cb(e):
print(&#34;Error:&#34;, e)
await nc.connect(&#34;nats://localhost:4222&#34;,
user_credentials=&#34;path_to_creds_file&#34;,
error_cb=error_cb,
)
# Do something with the connection
await nc.close()
</code></pre>
</div>