Closed swap357 closed 6 years ago
Duplicate #75
Sorry about this one. We’ve shifted our focus a bit lately and left it broken, but it should be straightforward to fix.
Sorry, I'm new to rust and custom codec development. Would you mind sharing a little more elaborate solution to the problem?
The following link no longer works- https://docs.rs/tokio-io/0.1/tokio_io/codec/length_delimited/struct.Builder.html
When we pass the --listen
flag to the server, it sets up a TCP listener on the desired port. Whenever there is a new connection, we handle it in this closure. Inside that closure, we wrap the raw socket in a Tokio codec. The codec's job is to decode incoming bytes into proper Rust types and also to encode outgoing messages as bytes. We're using the length_delimited
codec, but that isn't working for large files. So instead we need to write our own implementation of the Encoder
and Decoder
traits (documented here), or find some existing implementation that splits large messages into smaller pieces and buffers them. We have one example of a custom codec here, which we wrap around the domain socket connection to the Electron application when we're not running in headless mode. That one deals with JSON and line-delimited values. This one would need to split and reassemble messages, but otherwise it would be used similarly. Hope that's somewhat helpful.
While running
script/xray --listen=8080 --headless /home/user/xray/
for xray_browserCannot get past this-
[No UI elements on the client browser]