-
Notifications
You must be signed in to change notification settings - Fork 92
Open
Description
Hi
There is a question about moving apparently client app from 11 to 12 cocaine at reverbrain mail list, please take a look and reply both here and in the mailgroup
We are trying move from cocaine 11 to 12 and I'm investigating details. I didn't find any docs about writing applications with cocaine12 and examples are too simple.
Now I'm interested how properly send big array of bytes in chunks?App:
worker.on("ping", [](worker::sender tx, worker::receiver rx) { std::cout << "After invoke" << std::endl; if (boost::optional<std::string> message = rx.recv().get()) { // app read one chunk std::cout << "After chunk: '" << *message << "'" << std::endl; tx.write(*message).get(); // app write one chunk std::cout << "After write" << std::endl; } std::cout << "After close" << std::endl; });Client:
task<void>::future_type on_invoke(task<channel<io::app::enqueue>>::future_move_type future) { auto channel = future.get(); auto tx = std::move(channel.tx); auto rx = std::move(channel.rx); return tx.send<scope::chunk>("le message") // client write one chunk .then(trace_t::bind(&on_send, std::placeholders::_1, rx)) .then(trace_t::bind(&on_chunk, std::placeholders::_1, rx)) // client read one chunk .then(trace_t::bind(&on_choke, std::placeholders::_1)); }In this example I see how to send one chunk from client to app and backward. But what should I do if I want to send 3 chunks from client to app and after that 5 chunks from app to client?
https://groups.google.com/forum/#!topic/reverbrain/4VGLV2-yIac
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels