Sonde v1.1.0
Embeddable Model Context Protocol server for Qt applications
Loading...
Searching...
No Matches
Sonde::Bridge::anonymous_namespace{bridge.cpp} Namespace Reference

Classes

class  Handshake
 What the client set up on its connection, so it can be replayed to a restarted application. More...
class  Bridge
 Copies lines between stdin/stdout and a QLocalSocket. More...

Functions

constexpr QLatin1StringView kOwnIdPrefix ("sonde-bridge:")
 Prefix of the ids the bridge uses for its own (replayed) requests.
QList< QJsonObject > messagesIn (const QByteArray &line)
 The messages in a JSON-RPC line: one object, or the elements of a batch.
QString idKey (const QJsonValue &id)
 An id as a hash key (its compact JSON text, so 1 and "1" differ).
QHash< QString, QJsonValue > messageIds (const QByteArray &line, bool requests)
 The ids of the requests (requests true: have a method) or responses (false: no method) in line, by idKey().
QByteArray jsonLine (const QJsonObject &message)
 One line of JSON-RPC: message, compact, with a newline.
QByteArray notConnectedError (const QJsonValue &id, const QString &message)
 A JSON-RPC error response to id saying the application is not connected.

Variables

constexpr int kRetryIntervalMs = 500
 How often a waiting bridge retries the connection.
constexpr int kDrainTimeoutMs = 30000
 After stdin closes, the longest the bridge waits for outstanding responses.
constexpr int kNotConnectedCode = -32000
 JSON-RPC error code for "the application is not connected" (server-defined range).