0
votes

Hello I have this code:

Status ListFeatures(ServerContext* context, const Rectangle* rectangle,
                    ServerWriter<Feature>* writer) override {
  auto lo = rectangle->lo();
  auto hi = rectangle->hi();
  long left = std::min(lo.longitude(), hi.longitude());
  long right = std::max(lo.longitude(), hi.longitude());
  long top = std::max(lo.latitude(), hi.latitude());
  long bottom = std::min(lo.latitude(), hi.latitude());
  for (const Feature& f : feature_list_) {
    if (f.location().longitude() >= left &&
        f.location().longitude() <= right &&
        f.location().latitude() >= bottom &&
        f.location().latitude() <= top) {
      writer->Write(f);
    }
  }
  return Status::OK;
}

This is server streaming RPC on Client Unary call.

I would like to not close the stream. Once the Client initiates the unary call I would like to keep the server stream "forever" so I can send messages whenever I like.

As far as I understand at the moment this line is executed:

return Status::OK;

The stream is getting closed. Is there any way I can keep it open so later I can send more server streaming messages?