MessageLspEndpoint class

A message-level endpoint for embedding the server in a host that already exchanges decoded JSON-RPC objects — a web IDE (over postMessage / a MessageChannel), an AI agent, or an in-process bridge.

Feed incoming messages with receive; outgoing messages are delivered to the send callback. No byte framing, no dart:io.

Inheritance

Constructors

MessageLspEndpoint(void _send(Map<String, Object?> message))

Properties

done Future<void>
Completes when the endpoint closes.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
onNotification NotificationHandler?
getter/setter pairinherited
onRequest RequestHandler?
getter/setter pairinherited
onResponse ResponseHandler?
Invoked for a JSON-RPC response (a message with an id but no method), i.e. the peer's reply to a request this endpoint sent. Set by LspClient; left null by a pure server, which never issues requests.
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

close() → void
Signals that the peer has disconnected.
handleMessage(Object? message) Future<void>
Routes one decoded incoming JSON-RPC message.
inherited
listen() → void
Begins consuming input. No-op for push-based endpoints (e.g. web).
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
receive(Map<String, Object?> message) → void
Delivers a decoded JSON-RPC message from the peer to the server.
sendNotification(String method, Object? params) → void
Sends a notification to the peer.
inherited
toString() String
A string representation of this object.
inherited
writeMessage(Map<String, Object?> message) → void
Writes a fully-formed JSON-RPC message to the wire.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited