aboutsummaryrefslogtreecommitdiff
path: root/docs/man/nng_ws.7.adoc
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-03-15 08:40:17 -0700
committerGarrett D'Amore <garrett@damore.org>2018-03-17 08:49:12 -0700
commit98f23e10cc1d65da6a7f6c7e4f5665d7afc27a86 (patch)
treee3cc06524b26fd0773d1742de82a00862f95c5f6 /docs/man/nng_ws.7.adoc
parent91866ed9365ab89069c12da41c873c23d0ba1d19 (diff)
downloadnng-98f23e10cc1d65da6a7f6c7e4f5665d7afc27a86.tar.gz
nng-98f23e10cc1d65da6a7f6c7e4f5665d7afc27a86.tar.bz2
nng-98f23e10cc1d65da6a7f6c7e4f5665d7afc27a86.zip
fixes #286 nng_pair0_open (and all others) need man page
fixes #279 consider restructuring man sections This represents a rather significant rework, and major editing effort, for the entire set of manual pages. All of the pages now have a section number in their filename; this assists in some other tooling, particularly ebook generation as every link needs to be programmatically modified when combined into an ebook. Section 5 is introduced, and populated with pages for the main types, and all options are now documented. Numerous errors have been corrected, including rewriting certain portions such as the header section of the surveyor protocol. Much work has been done to facilitate index generation, although certainly more work remains here. Every internal link within these pages now resolves; there are no more dead links. (This is required to generate Kindle format books.)
Diffstat (limited to 'docs/man/nng_ws.7.adoc')
-rw-r--r--docs/man/nng_ws.7.adoc186
1 files changed, 186 insertions, 0 deletions
diff --git a/docs/man/nng_ws.7.adoc b/docs/man/nng_ws.7.adoc
new file mode 100644
index 00000000..f3d59a63
--- /dev/null
+++ b/docs/man/nng_ws.7.adoc
@@ -0,0 +1,186 @@
+= nng_ws(7)
+//
+// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2018 Capitar IT Group BV <info@capitar.com>
+//
+// This document is supplied under the terms of the MIT License, a
+// copy of which should be located in the distribution where this
+// file was obtained (LICENSE.txt). A copy of the license may also be
+// found online at https://opensource.org/licenses/MIT.
+//
+
+== NAME
+
+nng_ws - WebSocket transport
+
+== SYNOPSIS
+
+[source,c]
+----
+#include <nng/transport/websocket/ws.h>
+
+int nng_ws_register(void);
+int nng_wss_register(void);
+----
+
+== DESCRIPTION
+
+(((WebSocket)))(((transport, _ws_ and _wss_)))
+The ((_ws_ transport)) provides communication support between
+_nng_ sockets across a TCP/IP network using
+https://tools.ietf.org/html/rfc6455[WebSockets].
+Both IPv4 and IPv6 are supported when the underlying platform also supports it.
+
+The protocol details are documented in
+http://nanomsg.org/rfcs/sp-websocket-v1.html[WebSocket Mapping for Scalability Protocols].
+
+=== Registration
+
+Depending upon how the library was built, it may be necessary to
+register the transport by calling <<nng_ws_register.3#,`nng_ws_register()`>>.
+
+If ((TLS)) support is enabled in the library, secure WebSockets (over TLS v1.2)
+can be used as well, but the secure transport may have to be registered using
+the <<nng_wss_register.3#,`nng_wss_register()`>> function.
+
+=== URI Format
+
+(((URI, `ws://`)))
+This transport uses URIs using the scheme `ws://`, followed by
+an IP address or hostname, optionally followed by a colon and an
+TCP port number, optionally followed by a path.
+(If no port number is specified then port 80 is assumed.
+If no path is specified then a path of `/` is assumed.)
+For example, the URI `ws://localhost/app/pubsub` would use
+port 80 on localhost, with the path `/app/pubsub`.
+
+Secure WebSockets (((WebSockets, Secure)))(((URI, `wss://`)))
+(if enabled) use the scheme `wss://`, and the default TCP port number of 443.
+Otherwise the format is the same as for regular WebSockets.
+
+When specifying IPv6 addresses, the address must be enclosed in
+square brackets (`[]`) to avoid confusion with the final colon
+separating the port.
+
+For example, the same path and port on the IPv6 loopback address (`::1`)
+would be specified as `ws://[::1]/app/pubsub`.
+
+NOTE: When using symbolic names, the name is resolved when the
+name is first used. _nng_ won't become aware of changes in the
+name resolution until restart,
+usually. (This is a bug and will likely be fixed in the future.)
+
+NOTE: The value specified as the host, if any, will also be used
+in the `Host:` ((HTTP header)) during HTTP negotiation.
+
+To listen to all ports on the system, the host name may be elided from
+the URL on the listener. This will wind up listening to all interfaces
+on the system, with possible caveats for IPv4 and IPv6 depending on what
+the underlying system supports. (On most modern systems it will map to the
+special IPv6 address `::`, and both IPv4 and IPv6 connections will be
+permitted, with IPv4 addresses mapped to IPv6 addresses.)
+
+=== Socket Address
+
+When using an <<nng_sockaddr.5#,`nng_sockaddr`>> structure,
+the actual structure is either of type
+<<nng_sockaddr_in.5#,`nng_sockaddr_in`>> (for IPv4) or
+<<nng_sockaddr_in6.5#,`nng_sockaddr_in6`>> (for IPv6).
+
+=== Server Instances
+
+This transport makes use of shared HTTP server (((HTTP, server)))
+instances, permitting multiple
+sockets or listeners to be configured with the same hostname and port.
+When creating a new listener, it is registered with an existing HTTP server
+instance if one can be found.
+Note that the matching algorithm is somewhat simple,
+using only a string based hostname or IP address and port to match.
+Therefore it is recommended to use only IP addresses or the empty string as
+the hostname in listener URLs.
+
+Likewise, when sharing a server instance, it may not be possible to alter
+TLS configuration if the server is already running, as there is only a single
+TLS configuration context for the entire server instance.
+
+All sharing of server instances is only typically possible within the same
+process.
+
+The server may also be used by other things (for example to serve static
+content), in the same process.
+
+=== Transport Options
+
+The following transport options are available. Note that
+setting these must be done before the transport is started.
+
+NOTE: The TLS specific options (beginning with `NNG_OPT_TLS_`) are
+only available for `wss://` endpoints.
+
+((`NNG_OPT_WS_REQUEST_HEADERS`))::
+
+This value is a string, consisting of multiple lines terminated
+by CRLF sequences, that can be used to add further headers to the
+HTTP request sent when connecting.
+This option can be set on dialers, and retrieved from pipes.
+
+((`NNG_OPT_WS_RESPONSE_HEADERS`))::
+
+This value is a string, consisting of multiple lines terminated
+by CRLF sequences, that can be used to add further headers to the
+HTTP response sent when connecting.
+This option can be set on listeners, and retrieved from pipes.
+
+((`NNG_OPT_TLS_CONFIG`))::
+
+This option is used on an endpoint to access the underlying TLS
+configuration object. The value is of type `nng_tls_config *`.
+
+TIP: Use this option when advanced TLS configuration is required.
+
+((`NNG_OPT_TLS_CA_FILE`))::
+
+This is a write-only option used to load certificates associated
+associated private key from a file.
+See <<nng_tls_config_ca_file.3tls#,`nng_tls_config_ca_file()`>> for more
+information.
+
+((`NNG_OPT_TLS_CERT_KEY_FILE`))::
+
+This is a write-only option used to load the local certificate and
+associated private key from a file. The private key used must be
+unencrypted.
+(Use the `NNG_OPT_TLS_CONFIG` option to access the underlying
+TLS configuration if more advanced configuration is needed.)
+See <<nng_tls_config_own_cert.3tls#,`nng_tls_config_own_cert()`>> for more
+information.
+
+((`NNG_OPT_TLS_AUTH_MODE`))::
+
+This is a write-only option used to configure the authentication mode
+used.
+It can take an integer with value `NNG_TLS_AUTH_MODE_NONE`,
+`NNG_TLS_AUTH_MODE_REQUIRED`, or `NNG_TLS_AUTH_MODE_OPTIONAL`.
+See <<nng_tls_config_auth_mode.3tls#,`nng_tls_config_auth_mode()`>> for more
+details.
+
+`NNG_OPT_TLS_VERIFIED`::
+
+This is a read-only option which returns a boolean value (integer 0 or 1).
+It will true (1) if the remote peer has been properly verified using TLS
+authentication, or false (0) otherwise. This option may return incorrect
+results if peer authentication is disabled with `NNG_TLS_AUTH_MODE_NONE`.
+
+// We should also look at a hook mechanism for listeners. Probably this could
+// look like NNG_OPT_WS_LISTEN_HOOK_FUNC which would take a function pointer
+// along the lines of int hook(void *, char *req_headers, char **res_headers),
+// and NNG_OPT_LISTEN_HOOK_ARG that passes the void * passed in as first arg.
+// Alternatively we can uplevel the HTTP API and pass the actual HTTP objects.
+
+== SEE ALSO
+
+<<nng_tls_config_alloc.3tls#,nng_tls_config_alloc(3tls)>>,
+<<nng_sockaddr.5#,nng_sockaddr(5)>>,
+<<nng_sockaddr_in.5#,nng_sockaddr_in(5)>>,
+<<nng_sockaddr_in6.5#,nng_sockaddr_in6(5)>>,
+<<nng.7#,nng(7)>>