KScript docs
EN

loopback_json_stream fields and methods

A field is a plain fact about the value, read with a dot and no brackets: $value.name. A method takes arguments or does work, and is called with ->: $value->name(arguments), or with the value piped in: $value |> name(arguments).

From KScript.Net

These need <import package="KScript.Net" />import KScript.Net. See KScript.Net.

#loopback_json_stream->read() → map KScript.Net

Reads one UTF-8 JSON object (up to 256 KiB) within the active transaction's deadline.
Example
<let name="reply" value="@with_loopback_json(8765, fn(connection) => $connection->transaction(fn(stream) => $stream->read()))" />
<echo>{ $reply.status }</echo>
$reply = @with_loopback_json(8765, fn(connection) => $connection->transaction(fn(stream) => $stream->read()))
echo $reply.status

#loopback_json_stream->send(frame: map) KScript.Net

Writes one newline-terminated UTF-8 JSON object (up to 256 KiB).
ParameterTakes
frame requiredmap
Example
<echo>{ @with_loopback_json(8765, fn(connection) => $connection->transaction(fn(stream) => $stream->send({ command: 'ping' }))) }</echo>
echo @with_loopback_json(8765, fn(connection) => $connection->transaction(fn(stream) => $stream->send({ command: 'ping' })))

Methods from any