rgb-cln/doc/lightning-sendcustommsg.7.md

71 lines
2.7 KiB
Markdown
Raw Normal View History

lightning-sendcustommsg -- Low-level interface to send protocol messages to peers
=====================================================================================
SYNOPSIS
--------
doc: escape more naughty underscores The only time underscores aren't special in Markdown is when they appear in preformatted text. We have gotten away with not escaping underscores where an asterisk-enclosed span or the paragraph ends before the next underscore appears, but this is fragile and bad practice. Conversely, there are many places where we have not escaped underscores but needed to. Escape all underscores that do not appear in preformatted blocks or preformatted spans and are not themselves delineating emphasized spans. The changes in this commit are exactly the result of executing the following Bash code: ```bash e=':x;' # begin loop e+='s/^' # anchor match at beginning of line e+='(' # begin capturing subexpression e+='(' # begin list of alternatives e+='[^`_\\]|' # any mundane character, or e+='`([^`\\]|\\.)*`|' # backtick-enclosed span, or e+='\b_|_\b|' # underscore at boundary, or e+='\\.' # backslash-escaped character e+=')*' # any number of the preceding alternatives e+=')' # end capturing subexpression e+='\B_\B/\1\\_/;' # escape non-formatting underscore e+='tx' # repeat loop if we escaped an underscore escape_underscores=( sed # use extended regular expressions -E # skip over indented blocks (following an empty line) -e '/^$/{:i;n;/^( {4,}|\t)/bi}' # skip over preformatted blocks -e '/^\s*```/,/^\s*```/{p;d}' # skip over generated sections -e '/GENERATE-FROM-SCHEMA-START/,/GENERATE-FROM-SCHEMA-END/{p;d}' # escape underscores -e "${e}" ) "${escape_underscores[@]}" -i doc/*.[0-9].md ``` Changelog-None
2022-11-11 01:44:56 +00:00
**sendcustommsg** *node\_id* *msg*
DESCRIPTION
-----------
The `sendcustommsg` RPC method allows the user to inject a custom message
into the communication with the peer with the given `node_id`. This is
intended as a low-level interface to implement custom protocol extensions on
top, not for direct use by end-users.
The message must be a hex encoded well-formed message, including the 2-byte
type prefix, but excluding the length prefix which will be added by the RPC
method. The message types may not be one of the internally handled
types, since that may cause issues with the internal state tracking of
Core Lightning. We do (as of *v23.11*) allow sending of even types, but note that peers (as per the spec) will disconnect on receiving unknown even types.
The node specified by `node_id` must be a peer, i.e., it must have a direct
connection with the node receiving the RPC call, and the connection must be
established. For a method to send arbitrary messages over multiple hops,
including hops that do not understand the custom message, see the
`createonion` and `sendonion` RPC methods. Messages can only be injected if
the connection is handled by `openingd` or `channeld`. Messages cannot be
injected when the peer is handled by `onchaind` or `closingd` since these do
not have a connection, or are synchronous daemons that do not handle
spontaneous messages.
On the reveiving end a plugin may implement the `custommsg` plugin hook and
get notified about incoming messages, and allow additional unknown even types in their getmanifest response.
RETURN VALUE
------------
The method will validate the arguments and queue the message for delivery
through the daemon that is currently handling the connection. Queuing provides
best effort guarantees and the message may not be delivered if the connection
is terminated while the message is queued. The RPC method will return as soon
as the message is queued.
If any of the above limitations is not respected the method returns an
explicit error message stating the issue.
[comment]: # (GENERATE-FROM-SCHEMA-START)
On success, an object is returned, containing:
- **status** (string): Information about where message was queued
[comment]: # (GENERATE-FROM-SCHEMA-END)
AUTHOR
------
Christian Decker <<decker.christian@gmail.com>> is mainly responsible.
SEE ALSO
--------
lightning-createonion(7), lightning-sendonion(7)
RESOURCES
---------
Main web site: <https://github.com/ElementsProject/lightning>
[comment]: # ( SHA256STAMP:5603fac5f46c7f91c625b33d98df1a2a587262788465ebd1db24433989425a2e)