Closed linux-china closed 4 years ago
I'm making a plan for supporting an abstract transport layer. For any kind of transport, you just need to implement a transport trait.
pub trait ClientTransport {
fn attach(
self,
incoming: Tx<Frame>,
sending: Rx<Frame>,
) -> Pin<Box<dyn Sync + Send + Future<Output = Result<(), Box<dyn Error + Send + Sync>>>>>;
}
PS: incoming
means frames should received and sending
means frames you want to send.
WASM feature is released in v0.5.0.
Construct transport layer and delegate the requests to Wasm Runtime, no API change for to compile Rust to WebAssembly. Now just client transport required only. For example WasmClientTransport, can accept "ws://xxx:8080/rsocket" or "tcp://xxx:42252", and requests will be delegated to Wasm runtime(Browser, Node) by calling import functions. Example as following: