10 ms·
Experimenting with Node.js
- deleted 16y ago[deleted]
- CitizenKane 16y agoExtremely cool demo. It would be interesting to see this applied to analytics, so you could see exactly what people are doing on your site in real time. Although that would also be a bit creepy.
- riklomas 16y agoThere's already something called Hummingbird that does that: http://mnutt.github.com/hummingbird/ http://mnutt.github.com/hummingbird/
- CitizenKane 16y agoHummingbird shows traffic in real time. It doesn't show mouse movement or user activity in real time.
- JakeSc 16y agoI am thoroughly impressed, and excited for the prospect of unimaginably awesome web applications. I do have a few thoughts: - How easy would this be to implement in another event-driven server, such as Tornado? - I have an identifiable "mouse ID" in this app. Is this secure? Surely the security aspects of web sockets have been key in their design, but I am left with a bit of uneasiness with my browser opening a TCP connection to another server. I believe WebSockets will pave the way for a whole new class of web-based attacks, and possibly even highly mobile worms.
- Joeboy 16y agoPlease could you move your cursors out of the way? I'm trying to read the text. Edit: This lame comment is the highest rated here? You disappoint me.
- jkreeftmeijer 16y agoThere's a "disable" button in the yellow box. That'll make them go away completely. :)
- ppplll 16y agoIt would be interesting to hear from the author how the server is handling HackerNews traffic
- jkreeftmeijer 16y agoHi, author here. While building this thing, the Node server had the tendency to drop out. I'm monitoring it with God (http://god.rubyforge.org/ http://god.rubyforge.org/) now, so it restarts whenever anything goes wrong. I'm genuinely impressed by how it's holding out now. :)
- deleted 16y ago[deleted]
- ppplll 16y agoWhat's the memory and cpu usage?
- mishmash 16y agoWhat kind of traffic have you gotten in the last hour?
- jokull 16y agoCould you elaborate on this at all? What kind of traffic are you getting (max concurrent requests handled perhaps)? Any idea why Node dropped out?
- MisterWebz 16y agoI'm wondering if Javascript will start being heavily used server-side? Would it be wise to start learning JS and how to use Node.js or is it absolutely not suitable for production use?
- Charuru 16y agoYou should absolutely start learning it. node.js already has a large amount of traction and is being used in production in numerous places: http://wiki.github.com/ry/node/ http://wiki.github.com/ry/node/
- jorangreef 16y agoRegardless of the popularity of Javascript on the server-side, if you're writing a web-based application, then your architecture will benefit from: 1. Shared code between client and server. 2. Specialization in one language. V8 and Node are at least a very good combination for server-side Javascript. Re: "is it absolutely not suitable for production use?" Node in alpha state is already more production ready than many "production ready" tools.
- kylemathews 16y agoThe cursors looked disturbingly like flies. Pretty insane demo.
- Kilimanjaro 16y agoMake it funnier, show us a maze and people trying to solve it in real time. Replace the mouse pointer with a colored token and constrain its movement to the walls of the maze.
- axod 16y agoThis was a startup idea I had when I started Mibbit (I decided on balance webchat had more potential than multiplayer web games). The idea was 'mouse games'. I had a similar setup where you could see everyones mouse cursor. I planned a whole load of multiplayer games where you could chase each other, complete puzzles, click on other people to kill them, draw circles round other players to trap them, etc etc. You could have messages show up like "First to draw a square gets a point". "Move to the left get a point". "Move as far away from everyone else as you can. Most isolated player gets a point". You could have objects being thrown at cursors, and you have to dodge them. Tons of potential to be a fun way for people to waste time :) I'm sure it would have been great fun to make :)
- icey 16y agoIt still sounds like a pretty cool idea to me - I'd certainly check it out if something like that existed.
- axod 16y agoBut would you also: * Come back regularly to play it? * Pay to play it?!! :/ * Click on ads? (If the creator were evil, they'd confuse the users into clicking on ads, making them think it's part of the game). Still a fun thing to make though!
- icey 16y agoAs with everything, it depends on the implementation ;) I think it's probably tougher to monetize a web game, but flash game creators seem to be doing moderately well with advertisements that run before you can play the game. There's an interesting hook in what you're talking about: I could IM a friend and say "hey jump on here, let's play together". It's much more social than most web games out there which is intriguing. In general most web pages feel like you're there by yourself. The model of seeing many other people there at the same time is novel enough right now that it should be a little easier to get people to tell each other about it.
- nhnifong 16y agoIt a strange mix of disappointment and excitement to find out someone has just released a better finished version of what you were working on. Oh well, I guess I'll finish it anyways.
- jkreeftmeijer 16y agoPlease let me know when you finish it. I would love to see your code. :)
- nhnifong 16y agoIt has mutated quite a lot since I started... I'm taking the positions of everyone's mouse and feeding them to Fortune's sweep line algorithm to make Voronoi diagrams. I've made it look like you are a cell squeezing through layers of tissue. http://uncc.ath.cx/applets/Voronoi_Standalone/ http://uncc.ath.cx/applets/Voronoi_Standalone/
- drats 16y agoamusing: http://i.imgur.com/qHWYm.jpg http://i.imgur.com/qHWYm.jpg
- weixiyen 16y agoI made this RPG node demo a while back: http://sleeperbot.com http://sleeperbot.com I'm not using any server monitoring so it can crash at any moment. Would love to get more than 15 users on here moving around and see what happens. code: http://github.com/weixiyen/avatar http://github.com/weixiyen/avatar
- someone_here 16y agoYour comment is less than a minute old and it's already giving a 502 Bad Gateway error :(
- weixiyen 16y agosorry was messing with nginx config. it's up now
- JakeSc 16y agoI would highly recommend sanitizing chat input. As a quick demo, type '<script>alert("a")</script>' or something. Very cool concept though.
- weixiyen 16y agothanks, i put that in. the blinky body toggle was pretty cool to see though :)
- reeses 16y agoWhy is it that within ten seconds, I felt compelled to "hump" other arrows with my own? It was also interested to see if I could get other people to form lines and other constructs, without any communication other than my own cursor.
- WilliamLP 16y agoI'm with you that I found the social implications of this many times more interesting than the technical ones!
- jamwt 16y agoWhile I think it's great that more and more developers are being exposed to building network applications using async I/O (which I guess is "evented" now) via Node.js, I think it's worthwhile to point out that the state of the art has moved well beyond these kind of callback frameworks. The reason is simple: it sucks programming in callback patterns on serious, large projects. You end up with lots of routines that are 6 or 7 callback chained together--and don't forget to attach error callbacks as well at each point. In the Python world, for example, eventlet, gevent, and diesel (disclosure: my project) all use coroutines to achieve very high performance asynchronous I/O that's still written in a "synchronous" style. And before that, CCP games has been using stackless python to do coroutine-based networking for the servers behind the very popular MMORPG eve online (http://www.tentonhammer.com/node/10044 http://www.tentonhammer.com/node/10044). Even slicker, in languages like Erlang and Haskell (via forkIO + the select/epoll I/O manager), support for asynchronous networking using "blocking-style" code is a fundamental language/compiler/vm feature. When you write any code in these languages, you're transparently taking advantage of the same scaling characteristics node.js and its ilk provide. So, I'd humbly suggest to anyone getting serious about doing this kind of programming that they investigate some of these systems (which are usually built by weary callback-style async I/O veterans) and leapfrog the rest of their peers. Consider Node.js a gateway drug. Linkage: http://eventlet.net/ http://eventlet.net/ http://github.org/jamwt/diesel http://github.org/jamwt/diesel http://en.wikipedia.org/wiki/Asynchronous_I/O#Light-weight_processes_or_threads http://en.wikipedia.org/wiki/Asynchronous_I/O#Light-weight_p... http://www.galois.com/~dons/slides/a-scalable-io-manager-for-ghc.pdf http://www.galois.com/~dons/slides/a-scalable-io-manager-for...
- icey 16y agoI think developers get attracted to frameworks because of fun examples like the one linked in the posting. Until there are multitudes of interesting examples using other tech, I think it's going to be an uphill battle to attract significant numbers of developers to them. Since many of the Node.js demos like this one are open-source it's much easier for developers to download working code and make modifications to see how everything works. The technically superior solutions often get overlooked for the most accessible ones.
- aslakhellesoy 16y agoWeb sockets are great, but almost all of the demos I see use a separate port (i.e. not port 80), making the app useless in practice. Come on guys - it's _Web_ sockets, not intranet sockets.
- lftl 16y agoCould you elaborate on why a nonstandard port makes these apps useless?
- user24 16y agocorporate firewalls blocking nonstandard ports, you running other apps on those ports, your firewall throwing a wobbly, general nonstandardness. if 80 is impractical, many people suggest running off 443 as that (the https port) is unlikely to be filtered.
- aslakhellesoy 16y agoIt's not hard to serve both regular http requests and web socket requests on the port 80 on the same host. Just use a special context path for web socket requests, for example /websocket/* Some of the node.js websocket impls let you do this easily while others don't. Don't use the ones that require a separate port. Nobody behind a corporate firewall will be able to use your app if you do.
- lenary 16y agoI think it is possible to have a ws server listening on the same port (and even path) as an http server, hence it shouldn't really matter. And if you really care, you could make a http forwarding proxy with node to forward normal http requests through to your app if it's written in something else, but deal with websockets itself.
- maushu 16y agoThe problem here is that to bind the websocket to the port 80 they would need to code their whole sites in node.js (with no reverse proxying from nginx and the likes) or at least make a reverse proxy in node.js and use it as front-end.
- olalonde 16y agoIs the server down? I cannot see any arrow even when I open multiple windows (Chrome 5).
- maushu 16y agoCheck your firewall, the websocket doesn't use the port 80.
- igrigorik 16y agoGreat stuff. Just for sake of completeness, you can basically copy-paste that code into Ruby as well via em-websocket: http://github.com/igrigorik/em-websocket http://github.com/igrigorik/em-websocket Also, to avoid some of the callback muck that a few have brought up: http://github.com/igrigorik/em-synchrony http://github.com/igrigorik/em-synchrony (same idea, closures + coroutines to abstract the callbacks).
- olalonde 16y agoFor some reason, the background picture is distorted when remote mouses hover it (Chrome 5). Anyone has an explanation?
- DaemonXI 16y agohttp://i.imgur.com/OCaBf.jpg http://i.imgur.com/OCaBf.jpg I feel OK about doing this.
- einaros 16y agoI feel conflicted about doing this: http://www.youtube.com/watch?v=jULOA7mSOac&fmt=22 http://www.youtube.com/watch?v=jULOA7mSOac&fmt=22