send method
Send a JSON-RPC message
Implementation
@override
void send(dynamic message) {
if (_isClosed) return;
// Check if this is the initialized notification
if (message is Map &&
message['method'] == 'notifications/initialized' &&
!_getStreamActive) {
_startGetStream();
}
_sendRequest(message).catchError((error) {
// A long-lived stateless `subscriptions/listen` SSE POST can still be
// unwinding when the transport is torn down (disconnect force-closes the
// connection). Guard against reporting the resulting connection error onto
// an already-closed controller.
if (!_isClosed && !_messageController.isClosed) {
_messageController.addError(error);
}
});
}