Code Monkey home page Code Monkey logo

Comments (7)

liamoc avatar liamoc commented on May 12, 2024 4

Any progress on this issue?

from scotty.

ocramz avatar ocramz commented on May 12, 2024 1

Well, now (since #233) you can have nested wai Applications under a Scotty route!

from scotty.

xich avatar xich commented on May 12, 2024

Ah I can implement this. I'm not near a computer right now, but soon. Thanks for reporting!

from scotty.

pxqr avatar pxqr commented on May 12, 2024

I think the most promising way to fix this issue is to make ScottyResponse more general:

data ScottyResponse = SR
  { srStatus  :: Status
  , srHeaders :: ResponseHeaders -- ^ additional headers to append to the srResponse
  , srResponse :: Network.Wai.Response
  }

I guess it is possible to keep existing API the same. Do you have some considerations against this changes or any better ideas?

from scotty.

crabmusket avatar crabmusket commented on May 12, 2024

I've been looking at websockets and Scotty and my current solution is to handle websockets outside the Scotty app. It's not elegant but it works.

from scotty.

bananu7 avatar bananu7 commented on May 12, 2024

What's the status on that? I wrote a simple handler to test how that could be done:

sse :: T.Text -> ActionM ()
sse t = do
     setCorsHeader
     setHeader "Content-Type" "text/event-stream"
     setHeader "Cache-Control" "no-cache"
     setHeader "Connection" "keep-alive"
     raw $ encodeUtf8 t

And it works, but drops the connection nevertheless.

from scotty.

bsima avatar bsima commented on May 12, 2024

What's the status on that? I wrote a simple handler to test how that could be done:

sse :: T.Text -> ActionM ()
sse t = do
     setCorsHeader
     setHeader "Content-Type" "text/event-stream"
     setHeader "Cache-Control" "no-cache"
     setHeader "Connection" "keep-alive"
     raw $ encodeUtf8 t

And it works, but drops the connection nevertheless.

Why does this drop the connection despite having the keep-alive header?

from scotty.

Related Issues (20)

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.