feat: add websocket upstream adapter

This commit is contained in:
a.tolmachev
2026-04-06 13:23:45 +03:00
parent b5f80c5d2f
commit 45ea011b7f
27 changed files with 978 additions and 30 deletions
+1
View File
@@ -238,6 +238,7 @@ fn runtime_test_failure_code(error: &RuntimeError) -> &'static str {
RuntimeError::GraphqlAdapter(_) => "runtime_graphql_error",
RuntimeError::GrpcAdapter(_) => "runtime_grpc_error",
RuntimeError::RestAdapter(_) => "runtime_rest_error",
RuntimeError::WebsocketAdapter(_) => "runtime_websocket_error",
RuntimeError::UnsupportedProtocol { .. } => "runtime_protocol_error",
RuntimeError::InvalidPreparedRequest { .. } => "runtime_request_error",
RuntimeError::MissingStreamingConfig { .. } => "runtime_streaming_config_error",
+13 -5
View File
@@ -1347,10 +1347,15 @@ impl AdminService {
}
pub async fn list_protocol_capabilities(&self) -> Vec<ProtocolCapabilityView> {
[Protocol::Rest, Protocol::Graphql, Protocol::Grpc]
.into_iter()
.map(protocol_capability_view)
.collect()
[
Protocol::Rest,
Protocol::Graphql,
Protocol::Grpc,
Protocol::Websocket,
]
.into_iter()
.map(protocol_capability_view)
.collect()
}
#[instrument(skip(self))]
@@ -3601,6 +3606,7 @@ fn validate_protocol_target(protocol: Protocol, target: &Target) -> Result<(), A
(Protocol::Rest, Target::Rest(_))
| (Protocol::Graphql, Target::Graphql(_))
| (Protocol::Grpc, Target::Grpc(_))
| (Protocol::Websocket, Target::Websocket(_))
);
if is_match {
@@ -3827,6 +3833,7 @@ fn demo_grpc_operation_payload() -> OperationPayload {
headers: BTreeMap::new(),
protocol_options: Some(crank_core::ProtocolOptions {
grpc: Some(crank_core::GrpcProtocolOptions { use_tls: false }),
websocket: None,
}),
streaming: None,
},
@@ -4007,6 +4014,7 @@ fn runtime_error_code(error: &RuntimeError) -> &'static str {
RuntimeError::GraphqlAdapter(_) => "graphql_error",
RuntimeError::GrpcAdapter(_) => "grpc_error",
RuntimeError::RestAdapter(_) => "rest_error",
RuntimeError::WebsocketAdapter(_) => "websocket_error",
RuntimeError::UnsupportedProtocol { .. } => "unsupported_protocol",
RuntimeError::MissingStreamingConfig { .. } => "streaming_config_error",
RuntimeError::UnsupportedExecutionMode { .. } => "streaming_mode_error",
@@ -4034,7 +4042,7 @@ fn protocol_capability_view(protocol: Protocol) -> ProtocolCapabilityView {
.filter(|behavior| protocol.supports_transport_behavior(*behavior))
.collect();
let supports_upload_artifacts = match protocol {
Protocol::Rest | Protocol::Graphql => Vec::new(),
Protocol::Rest | Protocol::Graphql | Protocol::Websocket => Vec::new(),
Protocol::Grpc => vec!["proto".to_owned(), "descriptor_set".to_owned()],
};