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

GitBook: [master] 61 pages modified

This commit is contained in:
Ginger Collison
2020-04-10 14:41:07 +00:00
committed by gitbook-bot
parent ed6c1ba06d
commit de933e912d
61 changed files with 348 additions and 378 deletions

View File

@@ -1,10 +1,10 @@
# Miscellaneous Functionalities
# Miscellaneous functionalities
This section contains miscellaneous functionalities and options for connect.
## Get the Maximum Payload Size
While the client can't control the maximum payload size, clients may provide a way for applications to obtain the configured [`max_payload`](../../nats-server/configuration/README.md#limits) after the connection is made. This will allow the application to chunk or limit data as needed to pass through the server.
While the client can't control the maximum payload size, clients may provide a way for applications to obtain the configured [`max_payload`](../../nats-server/configuration/#limits) after the connection is made. This will allow the application to chunk or limit data as needed to pass through the server.
{% tabs %}
{% tab title="Go" %}
@@ -182,9 +182,7 @@ nc.close();
## Set the Maximum Control Line Size
The protocol between the client and the server is fairly simple and relies on a control line and sometimes a body. The control line contains the operations being sent, like PING or PONG, followed by a carriage return and line feed, CRLF or "\r\n".
The server has a [`max_control_line`](../../nats-server/configuration/README.md#limits) option that can limit the maximum size of a control line. For PING and PONG this doesn't come into play, but for messages that contain subject names and possibly queue group names, the control line length can be important as it effectively limits the possibly combined length.
Some clients will try to limit the control line size internally to prevent an error from the server. These clients may or may not allow you to set the size being used, but if they do, the size should be set to match the server configuration.
The protocol between the client and the server is fairly simple and relies on a control line and sometimes a body. The control line contains the operations being sent, like PING or PONG, followed by a carriage return and line feed, CRLF or "\r\n". The server has a [`max_control_line`](../../nats-server/configuration/#limits) option that can limit the maximum size of a control line. For PING and PONG this doesn't come into play, but for messages that contain subject names and possibly queue group names, the control line length can be important as it effectively limits the possibly combined length. Some clients will try to limit the control line size internally to prevent an error from the server. These clients may or may not allow you to set the size being used, but if they do, the size should be set to match the server configuration.
> It is not recommended to set this to a value that is higher than the one of other clients or the nats-server.
@@ -242,10 +240,9 @@ let nc = NATS.connect({
## Turn On/Off Verbose Mode
Clients can request _verbose_ mode from NATS server. When requested by a client, the server will reply to every message from that client with either a +OK or an error -ERR. However, the client will not block and wait for a response. Errors will be sent without verbose mode as well and client libraries handle them as documented.
Clients can request _verbose_ mode from NATS server. When requested by a client, the server will reply to every message from that client with either a +OK or an error -ERR. However, the client will not block and wait for a response. Errors will be sent without verbose mode as well and client libraries handle them as documented.
> This functionality is only used for debugging the client library or the nats-server themselves.
> By default the server sets it to on, but every client turns it off.
> This functionality is only used for debugging the client library or the nats-server themselves. By default the server sets it to on, but every client turns it off.
To turn on verbose mode:

View File

@@ -1,4 +1,4 @@
# Setting the Connection Name
# Connection Name
Connections can be assigned a name which will appear in some of the server monitoring data. This name is not required, but is **highly recommended** as a friendly connection name will help in monitoring, error reporting, debugging, and testing.
@@ -86,4 +86,5 @@ let nc = await connect({
nc.close();
```
{% endtab %}
{% endtabs %}
{% endtabs %}

View File

@@ -6,7 +6,7 @@ The client and server use a simple PING/PONG protocol to check that either of th
Once a configurable maximum of outstanding pings without a single pong reply is hit, the connection is closed as stale. Together these two values define a timeout for the connection which specifies how quickly the client will be notified of a problem. This will also help when there is a remote network partition where the operating system does not detect a socket error. Upon connection close the client will attempt to reconnect. When it knows about other servers, these will be tried next.
In the presence of traffic, such as messages or client side pings, the server will not initiate the PING/PONG interaction.
In the presence of traffic, such as messages or client side pings, the server will not initiate the PING/PONG interaction.
On connections with a lot of traffic, the client will often figure out there is a problem between PINGS, and as a result the default PING interval is often on the order of minutes. To set the interval to 20s and limit outstanding pings to 5, thus force a closed connection after 100s of inactivity:
@@ -94,3 +94,4 @@ nc.close();
```
{% endtab %}
{% endtabs %}