8 ms·
Deno Deploy Demo: a multi-datacenter chat, client+server in 23 lines of TS
- deleted 5y ago[deleted]
- vnglst 5y agoNice, I like how short and simple it is. The title seems to imply it runs on multiple datacenters. How does it sync messages between those?
- jitl 5y agoI believe the BroadcastChannel implements the server-side distributed messaging.
- ondras 5y agoRight, as jitl suggested. The BroadcastChannel is used to allow cross-datacenter messaging. So every script instance has its own set of clients and forwards incoming client messages to other script/datacenter instances. I suppose this is not limited to multiple datacenters, but to multiple script instances in one datacenter as well.
- schemescape 5y agoI was also wondering how this worked, and the following Deno Deploy documentation explains it: https://deno.com/deploy/docs/runtime-broadcast-channel/#broadcastchannel https://deno.com/deploy/docs/runtime-broadcast-channel/#broa...
- deleted 5y ago[deleted]
- vnglst 5y agoWhat I really like about this is that you open the dependency in a web browser and see the human readable source code. No transpiling! https://deno.land/std/http/server.ts https://deno.land/std/http/server.ts
- honkycat 5y agoDeno is such a nice little scripting tool. I've been using it for devops glue and scripts lately. Native typescript, easy-as-pie dependency management. its great!
- IshKebab 5y agoI agree - also rock solid IDE support helps. It's really lightyears ahead of any other scripting options (Bash, Python, etc.)
- andyfleming 5y agoDo you have any libraries you use often with scripts or mostly just deno built-ins?
- 29athrowaway 5y agoPersonally I do not like the fact that it puts too much trust into DNS. DNS wasn't created with security in mind, so to say Deno is secure because it uses a permissions system while relying directly into DNS for imports to me sounds weird.
- IshKebab 5y agoIt uses https. Are you not satisfied that that is reasonably secure?
- simonw 5y agoIt's not just DNS, thankfully - deno.land has a TLS certificate too, which I think means that DNS exploits wouldn't succeed in causing clients to install untrusted packages.
- koprulusector 5y agoHow is this any different than any other package management system? If you npm or pip install a package and import it, you’re still relying on DNS to resolve pypi or npmjs. But with deno, if you’ve just accidentally installed some malicious squatters’ package that mimics the one you meant to use, at least you’ve got less exposure because the malicious code won’t necessarily have blanket permissions to make network calls, read files, etc. virtually any other language/package management system cannot say the same. deno will download and cache the dependencies you import, they’re right in the project folder vs buried in a sea of node_modules. It’s super convenient to look at and inspect, if there’s any doubt or idle curiosity.
- ranger_danger 5y agowhat is TS?
- ondras 5y agoTypeScript...
- ranger_danger 5y agowhat, I'm just supposed to know that?
- orf 5y agoI think it's not unobvious if you open the link
- capableweb 5y agoTo be fair, there is absolutely zero information about what technology is being used on the page the submission links to. Clicking the top-left icon brings you to "https://dash.deno.com/projects https://dash.deno.com/projects" which then forces you to login, still not giving any indication on what this thing is about or even written in. I can see how you can get confused, even if I wasn't as I'm around the JS community.
- Mikeb85 5y agoWhen discussing Deno, yes.
- agumonkey 5y agoNothing is to be known by everybody. But it's surprising that you don't associate typescript with deno. Unless you didn't know about deno in the first place. Just saying because TS had some kind of popularity these days.
- amadeuspagel 5y agoHere's a version that resets the input field when you hit enter: https://dash.deno.com/playground/careful-toad-72 https://dash.deno.com/playground/careful-toad-72
- mwcampbell 5y agoHas anyone written a comparison of Deno Deploy and Cloudflare Workers yet?
- babelfish 5y agoDeno: 28 datacenters Workers: 200+ datacenters
- Soremwar 5y agoNot that simple of a comparison since "data centers" mean a different thing in both cases
- capableweb 5y agoDeno: written by a guy who regrets his previous attempt at writing a programming environment CloudFlare: global, huge company who regrets they don't already route 100% of internet traffic Edit: I should add, I commend both efforts, both probably improve the world more than they hurt it, just injecting a bit of humor.
- 1_player 5y agoThere's few things as fun as a multiplayer notepad that wasn't intended to be an actual chat, before it's invaded by bots and spammers. Congrats on the fella that tried to paste an ascii art version of Pepe the Frog.
- ushakov 5y agoyes, it was me all along https://imgur.com/a/aEHjQcp https://imgur.com/a/aEHjQcp update: the original version was too spammy, i have changed it so that pepe only responds to greetings or when you type "pepe" update 2: i have throttled pepe so it only comes back after minute of cooldown
- ushakov 5y agocode for pepe is now available: https://gist.github.com/mishushakov/eb281f8edbb7e2bd2e6580de193d87f4 https://gist.github.com/mishushakov/eb281f8edbb7e2bd2e6580de...
- Lucasoato 5y agoThanks for posting pepe, my friend
- divan 5y agoRelated: https://news.ycombinator.com/item?id=12477190 https://news.ycombinator.com/item?id=12477190
- simonw 5y agoThis is such a neat demo. I wrote up an annotated version of the code while I was figuring out exactly how it worked. https://til.simonwillison.net/deno/annotated-deno-deploy-demo https://til.simonwillison.net/deno/annotated-deno-deploy-dem...
- zcbenz 5y agoI'm a bit confused when people say "native TypeScript" and "no transpiling" about Deno, does Deno now execute TypeScript without translating it to JavaScript first?
- koprulusector 5y agoIt always did. That’s been a core feature / benefit from day 1.
- bryanrasmussen 5y agoso question - normally the thing I like about Node.js is not much context switching and ability to rerun code between backend and frontend. I can get the same thing with TS if I compile in both backend and frontend - if in Deno I don't compile and in the frontend I do are there any weird gotchas I would run into?
- andyferris 5y agoDeno is aiming to have better compatibility with web standards than Node, so you should encounter fewer gotchas from reusing code in backend and frontend.
- capableweb 5y agoNo, it never did, Deno always have converted TypeScript into JavaScript that then gets read and executed by the browser, at least according to their own docs but maybe that has changed lately? > At a high level, Deno converts TypeScript (as well as TSX and JSX) into JavaScript. It does this via a combination of the TypeScript compiler, which we build into Deno, and a Rust library called swc. When the code has been type checked and transformed, it is stored in a cache, ready for the next run without the need to convert it from its source to JavaScript again. https://deno.land/manual/typescript/overview https://deno.land/manual/typescript/overview
- koprulusector 5y ago
- Donckele 5y agolove the chat spamming going on…