pub struct RemoteConfig {
pub server_address: ServerAddress,
pub channel_name: String,
pub conversation_id: ConversationId,
pub pool_config: ConnectionPoolConfig,
/* private fields */
}Expand description
Configuration for remote SDK handles.
Fields§
§server_address: ServerAddressRemote server address. Remote mode cannot be created without this value.
channel_name: StringApplication-visible channel name.
conversation_id: ConversationIdApplication-visible conversation identifier.
pool_config: ConnectionPoolConfigCaller/runtime-supplied connection pool configuration.
Implementations§
Source§impl RemoteConfig
impl RemoteConfig
Sourcepub fn read_wake(&self) -> Option<ReadWake>
pub fn read_wake(&self) -> Option<ReadWake>
The transport’s read wake, when it has one (the TCP transport on unix).
The wake is the transport’s, shared by every handle over it: it
interrupts budgeted participant reads (receive_within, and the fence
wait in try_receive) on any of them, and never the reply-owed
receive or the transport’s own request/response exchanges. See
ReadWake for exactly which reads.
Sourcepub fn new(
server_address: impl Into<String>,
channel_name: impl Into<String>,
conversation_id: impl Into<ConversationId>,
pool_config: ConnectionPoolConfig,
) -> Result<Self, SdkError>
pub fn new( server_address: impl Into<String>, channel_name: impl Into<String>, conversation_id: impl Into<ConversationId>, pool_config: ConnectionPoolConfig, ) -> Result<Self, SdkError>
Creates remote configuration with a required server address and pool config.
The returned configuration is NOT connected. It carries a placeholder
transport that owns no socket, and every publish, subscribe,
conversation, and resume operation performed through it refuses with
SdkError::NotConnected. Call connect_tcp, connect_tcp_with_auth,
connect_websocket, connect_websocket_with_auth, or (with the
embedded feature) connect_loopback to install a live transport
first.
This is deliberate loudness. The placeholder used to encode each frame,
discard it, and return a synthesised Accept, so a caller who forgot to
connect saw nothing but green results for messages that reached no wire.
§Errors
Returns SdkError if the address or pool configuration is invalid.
Sourcepub fn connect_tcp(self) -> Result<Self, SdkError>
pub fn connect_tcp(self) -> Result<Self, SdkError>
Opens a real TCP connection to the configured server and installs the live wire transport, replacing the in-process protocol transport.
This performs the protocol handshake (Connect -> ConnectAck) eagerly,
so a returned configuration is already connected to the server. Subsequent
publish, subscribe, and conversation calls traverse the socket.
§Errors
Returns SdkError::Connection when the TCP connection cannot be
established and SdkError::Protocol when the handshake is rejected.
Sourcepub fn connect_tcp_with_auth(self, auth_token: &[u8]) -> Result<Self, SdkError>
pub fn connect_tcp_with_auth(self, auth_token: &[u8]) -> Result<Self, SdkError>
Opens a real TCP connection whose handshake carries auth_token, for a
server gated by an [auth] section, and installs the live wire transport.
Additive to connect_tcp: an empty token behaves identically to it. The
server compares the token during the handshake and closes the connection on
a mismatch, which surfaces here as SdkError::Connection.
§Errors
Returns SdkError::Connection when the TCP connection cannot be
established or the token is rejected, and SdkError::Protocol when the
handshake frames cannot be encoded or sent.
Sourcepub fn connect_websocket(self) -> Result<Self, SdkError>
pub fn connect_websocket(self) -> Result<Self, SdkError>
Opens a real WebSocket connection to the configured ws:// server
address and installs the live wire transport, replacing the in-process
protocol transport.
This performs the WebSocket upgrade and the protocol handshake
(Connect -> ConnectAck) eagerly through the client unit’s typed
permit path, so a returned configuration is already connected.
Subsequent publish, subscribe, and conversation calls traverse the
socket; the concretely typed transport stays reachable through
websocket_transport for the typed
reconnect path.
§Errors
Returns SdkError::Connection when the address is not a usable
ws:// URL, the connection cannot be established, or the handshake is
rejected, and SdkError::Protocol when frames cannot be encoded.
Sourcepub fn connect_websocket_with_auth(
self,
auth_token: &[u8],
) -> Result<Self, SdkError>
pub fn connect_websocket_with_auth( self, auth_token: &[u8], ) -> Result<Self, SdkError>
Opens a real WebSocket connection whose handshake carries
auth_token, for a server gated by an [auth] section, and installs
the live wire transport. Additive to connect_websocket: an empty
token behaves identically to it.
§Errors
Returns SdkError::Connection when the connection cannot be
established or the token is rejected, and SdkError::Protocol when
the handshake frames cannot be encoded or sent.
Sourcepub fn websocket_transport(&self) -> Option<Arc<WebSocketRemoteTransport>>
pub fn websocket_transport(&self) -> Option<Arc<WebSocketRemoteTransport>>
The concretely typed WebSocket transport installed by
connect_websocket, when one is installed.