https://discord.cloudflare.com logo
Join Discord
Powered by
# durable-objects
  • v

    vans163

    04/02/2021, 3:05 PM
    Interesting, so a psuedo ticking DO might be possible? something like using setInterval or setTImeout that calls setTImeout agian inside? do you know if the proc off the timeout counts as 1 request?
  • v

    vans163

    04/02/2021, 3:05 PM
    billed at 0.15$ per MM
  • v

    vans163

    04/02/2021, 3:06 PM
    Copy code
    function tick() {
      setTimeout(tick, 100)
    }
    //on the DO constructor init
    setTimeout(tick, 100)
  • v

    vans163

    04/02/2021, 3:06 PM
    would this pattern work inside a DO?
  • a

    AlexRobinson

    04/02/2021, 3:07 PM
    it won't keep the DO alive, but if the DO is alive for other reasons (other requests, websockets) then it'll repeatedly run whatever's in tick
  • v

    vans163

    04/02/2021, 3:12 PM
    if there is atleast 1 websocket connection to the do?
  • v

    vans163

    04/02/2021, 3:12 PM
    the idea is mostly to check for zombied sockets. like the effect that happens when the sender can send down the socket and the tcp stack still thinks the conn is alive
  • v

    vans163

    04/02/2021, 3:12 PM
    so send on the server does not return sockerr
  • v

    vans163

    04/02/2021, 3:13 PM
    but the client has fully disconnected
  • v

    vans163

    04/02/2021, 3:13 PM
    happens if TCP gets into a wierd state like the client pulls out tthe eth cord
  • p

    pootify

    04/02/2021, 3:21 PM
    question about DO pricing, based on the workers chat demo (), does this cover everything that we would be charged for? based on the pricing listed in
    Copy code
    - $0.15 per million requests made the DO Worker (is a "request" just the WebSocket connection, or each message sent over the Websocket?)
    - $12.50 per million seconds of WebSocket connections to the DO WebSocket Server worker
    - $0.09 per GB transferred through the DO WebSocket Server worker
    - $0.20 per million 4 KB reads, $1.00 per million 4KB writes, $1.00 per million deletes on the DO WebSocket Server worker
    - $0.20 per GB stored on the DO WebSocket Server worker
  • j

    john.spurlock

    04/02/2021, 3:45 PM
    Not as of yesterday afternoon (https://discord.com/channels/595317990191398933/779390076219686943/827311907433611294) Deal breaker for me (and most real workers?) trying to use a single module for DO and worker. Fortunately DOs can still be called from non-module workers, but two script deploys and having to stub out a fetch method in the DO is less than ideal.
  • a

    AlexRobinson

    04/02/2021, 4:38 PM
    If there's at least 1 websocket, then it'll be kept alive and yes all will be fine
  • a

    AlexRobinson

    04/02/2021, 4:39 PM
    We'll be adding waitUntil back in for module-based workers soon. Sorry for the inconvenience of not having it there from the start
  • v

    vans163

    04/02/2021, 4:43 PM
    I really wish this was cputime not walltime, the whole point of the websockets atleast to me is to have events. so 24/7 connected clients that might get 1 event randomly every few hours.
  • v

    vans163

    04/02/2021, 4:43 PM
    otherwise we can just use longpoll or request-response
  • v

    vans163

    04/02/2021, 4:44 PM
    like a client signs into their dashboard and the websocket connects, then the client might go drink coffee / idle for 8 hours doing nothing, but the connection needs to stay open
  • p

    pootify

    04/02/2021, 4:58 PM
    that's our current issue with AWS API Gateway WebSockets -- we pay for all their idle time
  • p

    pootify

    04/02/2021, 4:59 PM
    even if we paid for all the idle time on Cloudflare, it might come out cheaper than AWS, but ideally not
  • d

    Deleted User

    04/02/2021, 5:22 PM
    Hi , I want to know if cloudflare durable objet can work with wasm or only js
  • k

    Kat

    04/02/2021, 8:02 PM
    Couldn't you have some sort of pre-determined timeout for inactivity? And then switch to poll based after x minutes of inactivity? As soon as you detect activity (mouse moving/keyboard typing in an input, then switch back to websocket 🤔 )
  • k

    Kat

    04/02/2021, 8:03 PM
    Definitely doesn't make sense to keep a websocket connection open.. if nobody is interacting with the webpage for 8 hours 😄
  • k

    Kat

    04/02/2021, 8:05 PM
    I believe the whole point of websockets (for me atleast) is for faster sending/receiving of events for when you're actively on and actual website and interacting with different things (in most scenarios)
  • v

    vans163

    04/02/2021, 10:07 PM
    Half the system is webbrowser the other half is worker nodes that need to respond to customer request immediatly
  • v

    vans163

    04/02/2021, 10:07 PM
    Worker nodes is a standalone app that runs 24/7
  • v

    vans163

    04/02/2021, 10:07 PM
    Not a web browser session
  • k

    Kat

    04/02/2021, 10:37 PM
    Gotcha 🙂 My statement would still apply for standalone apps too.. but unfortunately it sounds like there will be no way around paying the "$12.50 per million seconds of WebSocket connections to the DO WebSocket" if you need 24/7 active websockets
  • s

    sepbot

    04/02/2021, 10:43 PM
    You could optimize your costs by terminating websockets on something like AWS API Gateway or fanout and having those backed by CF workers and DO.
  • m

    matt

    04/02/2021, 10:47 PM
    fixed this one this afternoon, hopefully will be in next week's release 🙂
  • k

    Kat

    04/02/2021, 10:55 PM
    Actually I think I did the wrong math
1...394041...567Latest