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

    Mooshua

    05/17/2021, 8:41 PM
    Can you tap into the “error” event to see if an error is detected, even if it isn’t thrown?
  • m

    Mooshua

    05/17/2021, 8:42 PM
    (Look for close code 1006)
  • v

    vans163

    05/17/2021, 9:12 PM
    Yea zombie socket, send works but other end is disconnected.
  • v

    vans163

    05/17/2021, 9:12 PM
    https://discord.com/channels/595317990191398933/773219443911819284/832024002314764299
  • v

    vans163

    05/17/2021, 11:52 PM
    Big thanks, i would not have been able to implement it without this. it works!
  • v

    vans163

    05/18/2021, 1:54 AM
    is there a way to disable strict mode on rollup?
  • v

    vans163

    05/18/2021, 1:54 AM
    it seems the nodejs package i imported has a very old dependency, that violates strictmode
  • v

    vans163

    05/18/2021, 1:54 AM
    and the entire project does not want to compile now
  • e

    Erwin

    05/18/2021, 1:57 AM
    Copy code
    output.strict
    Type: boolean
    CLI: --strict/--no-strict
    Default: true
    
    Whether to include the 'use strict' pragma at the top of generated non-ES bundles. Strictly speaking, ES modules are always in strict mode, so you shouldn't disable this without good reason.
  • v

    vans163

    05/18/2021, 1:57 AM
    yea i tried it didnt help
  • v

    vans163

    05/18/2021, 1:58 AM
    im just gonna use the module as a UMD
  • v

    vans163

    05/18/2021, 1:58 AM
    (or atleast try)
  • e

    Erwin

    05/18/2021, 1:58 AM
    Yeah, that is what I would have tried next too..
  • d

    Deebster

    05/18/2021, 2:58 AM
    Yup, I'd done that, and you're right about it being 1006:
    {"wasClean":false,"reason":"WebSocket disconnected without sending Close frame.","code":1006,"type":"close"}
  • d

    Deebster

    05/18/2021, 3:07 AM
    Hah, now you point me back to that message I can remember reading it (but it wasn't relevant to me then :P). It looks like they know about it, but I still think the demo should be changed... Maybe I'll drop in a PR once I'm 100% happy with my ping/pong fix.
  • t

    taro

    05/18/2021, 1:24 PM
    Regarding the behind-the-scenes optimization of IDs generated with
    idFromName
    , is cloudflare essentially "caching" the global position/ID/etc. with KV? I'm considering implementing a KV mapping between my domain specific names/IDs and DO IDs generated using
    newUniqueId
    , but I imagine this might already be done behind the scenes... is this the case?
  • b

    brett

    05/18/2021, 1:39 PM
    Yeah, we do cache their location (though not in KV). I'm not sure that doing your own layer in KV would add any benefit over just using
    idFromName
  • e

    Erwin

    05/18/2021, 1:45 PM
    Remember the advantage from
    newUniqueId
    is only in the initial creation of the DO.. any subsequent invocations will run at very comparable speeds.
  • b

    brett

    05/18/2021, 1:46 PM
    Kind of 🙂 Each colo caches the true location, so the first request from any given colo may be a little slower (but this wouldn't be very different from getting it from KV) -- and of course the cache item could be evicted, etc.
  • b

    brett

    05/18/2021, 1:48 PM
    But yeah, from a single given client location you can expect them to be very similar after that first request
  • e

    Erwin

    05/18/2021, 1:51 PM
    Ah yeah, you have the first request per colo too. But yeah, that wouldn't be much different than a KV one indeed.
  • b

    brett

    05/18/2021, 1:54 PM
    https://blog.cloudflare.com/doom-multiplayer-workers/
  • b

    brett

    05/18/2021, 1:54 PM
    ^ some Durable Object fun
  • j

    joe

    05/18/2021, 1:54 PM
    ohhh is this the post Erwin mentioned
  • j

    joe

    05/18/2021, 1:55 PM
    oh that is super cool
  • t

    taro

    05/18/2021, 2:34 PM
    thanks for the thorough responses yall
  • t

    taro

    05/18/2021, 2:34 PM
    btw that doom blog post is badass
  • t

    taro

    05/18/2021, 2:34 PM
    could concurrency ever be an issue for such an application?
  • t

    taro

    05/18/2021, 2:35 PM
    given that DOs are single-threaded?
  • m

    Mooshua

    05/18/2021, 3:06 PM
    I'm not sure it'd be a problem until you get 20 or more clients
1...858687...567Latest