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

    Greylock

    07/02/2021, 1:11 PM
    ie, it would be cheaper than paying for wall time
  • d

    Deebster

    07/02/2021, 4:03 PM
    Given that it's free to proxy websockets, I'm hoping that (at least) the paid workers plan will bundle a generous amount of websocket termination. My pet project is a (self-funded) distance-learning resource for teachers and some of the proposed billing setups will rule out Cloudflare for me!
  • g

    Greylock

    07/02/2021, 4:04 PM
    I am hopeful as well.
  • g

    Greylock

    07/02/2021, 4:04 PM
    I think in the end a reasonable pricing model will prevail 🙂
  • d

    Deebster

    07/02/2021, 4:06 PM
    Fingers crossed! I doubt that the orange names we see in here make the decision so hopefully those in control of the purse strings agree 🙂
  • g

    Greylock

    07/02/2021, 5:07 PM
    Any ideas about how to use durable objects for managing real-time state across multiple different objects of interest?
  • g

    Greylock

    07/02/2021, 5:07 PM
    Ie, a client might want real-time websocket updates regarding its user data, game data and chat data, which are all separate durable objects
  • g

    Greylock

    07/02/2021, 5:08 PM
    But it seems a little awkward to have the client open a ws connection for each
  • m

    mikeysee

    07/03/2021, 4:22 AM
    is it possible to access a Postgres instance from a Durable Object? Would the DB connection hang around?
  • j

    john.spurlock

    07/03/2021, 5:38 PM
    Hmm, I have a single instance of a DO that hangs indefinitely on any call to
    this.state.storage
    (list, get) no matter how trivial. The DO instance is alive, it responds to other non-storage requests. Any way to further debug or access the state in another way?
  • w

    Wallacy

    07/03/2021, 9:20 PM
    Try a “Comm DO” object and send the updates from other DO to this one. And the user will only need to connect to that end point.
  • w

    Wallacy

    07/03/2021, 9:21 PM
    How is that call? Using await, promise.resolve?
  • j

    john.spurlock

    07/03/2021, 9:22 PM
    await. The promises never return, and the http call never times out! It feels like a db transaction lock honestly, but I'm not using transactions.
  • w

    Wallacy

    07/03/2021, 10:07 PM
    Probably a unhandled exception, but only cloudflare devs can look at that!
  • g

    Greylock

    07/04/2021, 1:52 AM
    hmm, I see what you mean
  • g

    Greylock

    07/04/2021, 1:52 AM
    a muxer sorta?
  • g

    Greylock

    07/04/2021, 1:57 AM
    is there a way to specifically allocate a DO to a region or no
  • w

    Wallacy

    07/04/2021, 1:57 AM
    Maybe. A simple DO that you can use to concentrate and dispatch all messages are e enough. If you users are DO too maybe just dispatch all messages to that DO can do the job.
  • w

    Wallacy

    07/04/2021, 1:57 AM
    Only EU for now.
  • g

    Greylock

    07/04/2021, 2:02 AM
    gotcha
  • g

    Greylock

    07/04/2021, 2:02 AM
    and uhh, will multiple WS clients be connected to the same worker for a DO
  • g

    Greylock

    07/04/2021, 2:02 AM
    or not necessarily
  • g

    Greylock

    07/04/2021, 2:03 AM
    I was hoping to have all users of a region connect to a worker in that region who could proxy/muxe all the data
  • w

    Wallacy

    07/04/2021, 2:15 PM
    The DO will be first created close to the first used that trigger the creation. All other at same region probably will be connect on the same. You can look at cf headers and create different DOs based on the region by yourself.
  • g

    Greylock

    07/05/2021, 1:43 AM
    Alright because ideally I can have just a few durable objects per region
  • g

    Greylock

    07/05/2021, 1:44 AM
    Because I’m hoping to basically do muxing to reduce bandwidth in my network
  • g

    Greylock

    07/05/2021, 1:44 AM
    And was hoping to use the edge network to perform the muxing
  • g

    Greylock

    07/05/2021, 1:59 AM
    But muxing is only effective if you can get multiple users in a region to connect to the same worker/DO
  • w

    Wallacy

    07/05/2021, 1:53 PM
    Another think that i'm missing is the ability to the DO know his own ID (preferably the used on "fromName"). That's useful when we need to fetch external resources as part of the initialization, from KV or other source.
  • p

    Peter Startsev

    07/05/2021, 2:09 PM
    Hi. Is there any example of creating a auth/rbac service in Durable Objects? I would like to store the user's token and their permissions in this. I can imagine how to do this. But an example could help a lot thx
1...121122123...567Latest