Giter Site home page Giter Site logo

Comments (4)

cchantep avatar cchantep commented on August 16, 2024

Will have a look. A test must be failing.

from reactivemongo-streaming.

vdebergue avatar vdebergue commented on August 16, 2024

I created a small play app to reproduce the behaviour: https://github.com/vdebergue/reactivemongo-test

  • Using documentSource, it's ok with chunked and streamed entity:
% curl -v http://localhost:9000/source
> GET /source HTTP/1.1
> Host: localhost:9000
>
< HTTP/1.1 200 OK
< Transfer-Encoding: chunked
< Content-Type: text/plain; charset=utf-8
< Date: Sun, 13 Nov 2016 21:54:58 GMT
<
1
2
3
# // connection stays opened
% curl -v http://localhost:9000/sourceStr
> GET /sourceStr HTTP/1.1
> Host: localhost:9000
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: text/plain; charset=utf-8
< Date: Sun, 13 Nov 2016 22:07:32 GMT
< Connection: close
<
1
2
3
# Connection kept opened
  • Using bulkSource and Ok.chunked, connection is closed:
% curl -v http://localhost:9000/bulk
> GET /bulk HTTP/1.1
> Host: localhost:9000
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Transfer-Encoding: chunked
< Content-Type: text/plain; charset=utf-8
< Date: Sun, 13 Nov 2016 22:00:35 GMT
<
* transfer closed with outstanding read data remaining
* Closing connection 0
curl: (18) transfer closed with outstanding read data remaining
  • Using bulkSource and a HttpEntity.Streamed, connection is kept opened but nothing is sent:
% curl -v http://localhost:9000/stream
*   Trying ::1...
* Connected to localhost (::1) port 9000 (#0)
> GET /stream HTTP/1.1
> Host: localhost:9000
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: text/plain; charset=utf-8
< Date: Sun, 13 Nov 2016 22:02:09 GMT
< Connection: close
<
// kept opened

And in the console, the line Got 0 ids keeps getting printed:

Got 0 ids
Got 0 ids
...

from reactivemongo-streaming.

cchantep avatar cchantep commented on August 16, 2024

To avoid having an empty chunk (from an empty result bulk) interpreted as LastChunk, can you try the following.

  def tailBulk = Action {
    val source = cursor()
      .bulkSource()
      .map { ids =>
        println(s"Got ${ids.size} ids")
        "X" + ids.mkString("\n")
    }

    Ok.chunked(source)
  }

from reactivemongo-streaming.

vdebergue avatar vdebergue commented on August 16, 2024

Seems to be an issue in play framework that doesn't interpret correctly Seq.empty

from reactivemongo-streaming.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.