pub struct WsSession { /* private fields */ }Expand description
A WebSocket session to the coordinator.
Provides synchronous request() for request-reply and subscribe_logs()
for streaming log events, both over the same WS connection.
Implementations§
Source§impl WsSession
impl WsSession
Sourcepub fn connect(addr: SocketAddr) -> Result<Self>
pub fn connect(addr: SocketAddr) -> Result<Self>
Connect to the coordinator via WebSocket.
If called from within an existing tokio runtime, uses that runtime. Otherwise creates a dedicated runtime with one worker thread so the WS receive loop keeps running after synchronous API calls return.
Sourcepub fn request(&self, data: &[u8]) -> Result<Vec<u8>>
pub fn request(&self, data: &[u8]) -> Result<Vec<u8>>
Send a request and wait synchronously for the reply.
data should be a serialized ControlRequest.
Returns the serialized ControlRequestReply.
Sourcepub fn subscribe_topics(
&self,
dataflow_id: Uuid,
topics: Vec<(NodeId, DataId)>,
) -> Result<(Uuid, Receiver<Result<Vec<u8>>>)>
pub fn subscribe_topics( &self, dataflow_id: Uuid, topics: Vec<(NodeId, DataId)>, ) -> Result<(Uuid, Receiver<Result<Vec<u8>>>)>
Subscribe to topic data via the coordinator’s topic inspection stream.
Sends a TopicSubscribe request, waits for the ack, then returns
a (subscription_id, receiver) pair. Binary WS frames with matching
subscription UUID prefix are dispatched to the receiver.
Sourcepub fn subscribe_logs(
&self,
request: &[u8],
) -> Result<Receiver<Result<Vec<u8>>>>
pub fn subscribe_logs( &self, request: &[u8], ) -> Result<Receiver<Result<Vec<u8>>>>
Subscribe to log events on this connection.
Sends the subscribe request (LogSubscribe or BuildLogSubscribe), waits for the ack, then returns a receiver for log event payloads.
Each received item is the serialized LogMessage.
Auto Trait Implementations§
impl !Freeze for WsSession
impl RefUnwindSafe for WsSession
impl Send for WsSession
impl Sync for WsSession
impl Unpin for WsSession
impl UnsafeUnpin for WsSession
impl UnwindSafe for WsSession
Blanket Implementations§
Source§impl<Source> AccessAs for Source
impl<Source> AccessAs for Source
impl<T> Allocation for T
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FitForCBox for T
impl<T> FitForCBox for T
type CBoxWrapped = Box_<T>
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request