Thanks! Ended up with this: 
    
    
    import nativesockets, httpbeast
    …
      
      get "/time-live":
        request.sendHeaders(Http200,@({"Content-Type": "text/event-stream"}))
        for i in 0 .. 10:
          let data =
            "retry: 3000\n" &
            "data: {time: \'" & getClockStr() & "\'} \n\n"
          request.send(data)
          await sleepAsync(1000)
        let nativeReq = request.getNativeReq()
        nativeReq.forget()
        nativeReq.client.close()
        result.matched=true
        break routesList
    
    
    Run

> NativeRequest-agnostic close would appreciated in a PR :)

I'll look into it 😉

Reply via email to