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

    Schmeisser

    06/03/2021, 10:23 AM
    anyway since I'm here to research usability of cloud for multiplayer games, and have next to no knowledge of cloud best practices, here's my next question. Is there anything stopping me and any reason why it would be a bad idea, to throw the equivalent of a game loop for a very simple game on a durable object?
  • f

    firefall

    06/03/2021, 10:53 AM
    I for one wouldn't stop you. but recently CF released Doom with working multiplayer powered by Durable Objects, so...
  • s

    Schmeisser

    06/03/2021, 11:34 AM
    from what I understand, the durable objects for that have nothing to do with the game logic, just communication?
  • c

    Constantin

    06/03/2021, 2:12 PM
    Is it possible to call other functions of a Durable Object, not only fetch?
  • s

    Schmeisser

    06/03/2021, 2:31 PM
    from my understanding, that is what stubs are for
  • c

    Constantin

    06/03/2021, 2:31 PM
    I also thought so, but it seems I'm unable to call any functions except fetch
  • s

    Schmeisser

    06/03/2021, 2:35 PM
    huh, weird. I mean, there's ways to work arround it if it's really true, but it seems a bit counterintuitive
  • k

    kenton

    06/03/2021, 3:46 PM
    yeah, at present, fetch() is the only form of communication implemented. We'd like to add more general RPC at some point.
  • c

    ckoeninger

    06/03/2021, 4:11 PM
    There's a pretty massive difference in hello world code size for the various compile to js languages on https://developers.cloudflare.com/workers/platform/languages#compiled-to-javascript you can try out the templates to see for yourself. As matt mentioned, bucklescript/reasonml/reasonscript/whatever-theyre-calling-it-this-week is the best I'm aware of, it's actually smaller than handwritten js in a lot of cases. If you just want a good type system that compiles to JS and don't care about anything else, that's what I'd look at. If you care about a more stable language ecosystem, f#/fable is a close second in terms of generated code. Scala and Kotlin have a good ecosystem, but generated code is a lot bigger. Purescript I don't have any experience with but might be another option. Anything else on that list of languages I'd stay away from unless you're a big fan of that particular language
  • c

    Constantin

    06/03/2021, 4:21 PM
    That's pretty unfortunate, means that we'd have to serialize/deserialize the content manually via the fetch function
  • c

    Constantin

    06/03/2021, 4:21 PM
    Is there any timeline on RPC?
  • m

    matt

    06/03/2021, 4:24 PM
    One of the folks in here was working on https://github.com/kwhitley/itty-durable as a way to have on a more RPC like interface on top of
    fetch()
    using ES6 proxies.
  • m

    matt

    06/03/2021, 4:25 PM
    It’s not in our near term roadmap
  • s

    SimplySerenity

    06/03/2021, 4:54 PM
    Can a single durable object handle thousands of concurrent websockets? I'm looking at migrating a web game that shares a consistent state over websockets with thousands of players
  • v

    Vanessa🦩

    06/03/2021, 6:40 PM
    I have a co-worker in Vancouver, Canada. Their colo is
    SEA
    according to /cdn-cgi/trace. Yet, when they access my script, the worker is running in
    LAX
    . And the Durable Object is also being created in
    LAX
    . Tried a few more locations via VPN: * user: Vancouver, Canada. Colo:
    SEA
    . Worker:
    LAX
    . DO:
    LAX
    . 🤔 * user: Frankfurt, Germany. Colo:
    FRA
    . Worker:
    FRA
    . DO:
    FRA
    . 🤗 * user: Sydney, Australia. Colo:
    SYD
    . Worker:
    SYD
    . DO:
    SIN
    . 🙃 * user: Tokyo, Japan. Colo:
    KIX
    . Worker:
    SJC
    . DO:
    SJC
    . 😬 We do have clients in Japan so I'm curious why the worker would not be in Asia, at least? Is the connection from Japan to
    SIN
    slower than to the US?
  • c

    Constantin

    06/03/2021, 7:16 PM
    Does anyone know what this error means? ``# could not be cloned.``
  • s

    SimplySerenity

    06/03/2021, 8:35 PM
    https://developers.cloudflare.com/workers/learning/using-durable-objects#limitations says "Not all Cloudflare locations support Durable Objects yet, so objects may not be created in exactly the same point-of-presence where they are first requested." :/
  • s

    SimplySerenity

    06/03/2021, 8:37 PM
    I assume it's the same story with workers
  • m

    Mallissin

    06/03/2021, 8:46 PM
    Weird that Tokyo is going to San Jose and not Singapore.
  • g

    Greg-McKeon

    06/03/2021, 9:17 PM
    We have a few users looking into this. Define "very simple" 🙂
  • g

    Greg-McKeon

    06/03/2021, 9:19 PM
    This depends in part on the routing associated with the zone. What zone is this?
  • g

    Greg-McKeon

    06/03/2021, 9:19 PM
    This isn't the case for Workers, they are supported in every PoP.
  • v

    Vanessa🦩

    06/03/2021, 9:19 PM
    How would I know the zone?
  • g

    Greg-McKeon

    06/03/2021, 9:20 PM
    Your limits here are the 128 MB limit and the fact that Durable Objects are single-threaded, so it depends on how active these WebSockets are.
  • g

    Greg-McKeon

    06/03/2021, 9:20 PM
    Where are you deploying to? workers.dev?
  • v

    Vanessa🦩

    06/03/2021, 9:20 PM
    Yes
  • v

    Vanessa🦩

    06/03/2021, 9:29 PM
    Are you sure there is no limit per DO? Won’t the VM run out of sockets?
  • g

    Greg-McKeon

    06/03/2021, 9:31 PM
    Just clarifying - for Workers, routing depends (somewhat) on the plan associated with your Cloudflare zone. Since workers.dev are free zones, they don't route to every colo. Durable Objects instantiate your Object near the colo your worker is running in. So, for the Tokyo example, the free tier routing is sending the traffic to SJC, where the Worker is run. When it calls DO, the nearest PoP with DO is SJC, so the DO runs there. This goes away if you upgrade the zone to the pro plan or above.
  • g

    Greg-McKeon

    06/03/2021, 9:31 PM
    nope, there's no socket limit.
  • v

    Vanessa🦩

    06/03/2021, 9:32 PM
    Wow. Then that's better than any single linux server. Impressive.
1...949596...567Latest