News for hackers. Stuff that matters.
Re:Browserver: a node.js HTTP server, in your browser by arturadib on Friday August 10, 2012 @12:33PM (#4366903)
TL;DR: This is a proxy server that routes HTTP requests from a unique subdomain (e.g. http://m7rp3u2ntr9t3xr.browserver.org) to a browser that's visiting browserver.org. The JavaScript in the browser then handles the HTTP response. This is possible thanks to a persistent connection between the browser and browserver.org, via some "websocket-like" protocol.

The title "node.js HTTP server, in your browser" is because the HTTP handler in the client (browser) has a Node-like API, see:

https://github.com/jed/browserver-client#example

Re:Browserver: a node.js HTTP server, in your browser by jedschmidt on Friday August 10, 2012 @01:56PM (#4367331)
Thank you for explaining this much better than I did!
Re:Browserver: a node.js HTTP server, in your browser by fichtl80 on Saturday August 11, 2012 @12:52AM (#4369482)
i get a gateway error
Re:Browserver: a node.js HTTP server, in your browser by bilalhusain on Friday August 10, 2012 @03:21PM (#4367770)
Re:Browserver: a node.js HTTP server, in your browser by jedschmidt on Friday August 10, 2012 @11:49AM (#4366660)
Hey all,

I put browserver together in my free time over the last week. It's still a bit of a toy, but I think it's useful to explore ideas around extending webhooks all the way to the browser, to simplify our increasingly complicated web architectures.

It's already late here in Tokyo, but I'll be up for a bit if anyone wants to chat/brainstorm about approaches like this (and also to make sure the server stays up).

Re:Browserver: a node.js HTTP server, in your browser by madrobby on Friday August 10, 2012 @11:53AM (#4366691)
I'm slightly disappointed that it's implemented in more than 140 bytes.

Keep on being awesome. :)

Re:Browserver: a node.js HTTP server, in your browser by shurane on Friday August 10, 2012 @11:52AM (#4366683)
Simple statement: stop being so cool.

On a related note, keep at it. I hope you go places.

And where/how did you get the idea?

Things like this make me wonder why I'm not having fun creating neat (and useful!) things.

Re:Browserver: a node.js HTTP server, in your browser by HerraBRE on Saturday August 11, 2012 @09:22AM (#4370035)
Hey! I am doing something very similar with PageKite (http://pagekite.net/), although the server does not run in a browser.

I've decided to try to get authors of similar tools together on a mailing list to discuss whether we can agree on a common protocol so our clients/servers (connectors/relays, backends/frontends) can be interoperable. Join us: http://mailman.klaki.net/mailman/listinfo/revprotun

Re:Browserver: a node.js HTTP server, in your browser by javajosh on Friday August 10, 2012 @01:54PM (#4367325)
I had this idea, too, the killer application is actually demos and talks, I think. The speaker sets up their browser server, asks the audience to hit a URL, and then demonstrates in real time aspects of the system.

It's also a very neat way to bring WebKit Inspector to bear on server style code. Glad you did it! I presume that you have a wildcard subdomain at the DNS level and then some Node parsing magic to correctly proxy. Why subdomains though? Why not just a tag like browserver.com/29adfija02 ?

Re:Browserver: a node.js HTTP server, in your browser by jedschmidt on Friday August 10, 2012 @01:59PM (#4367346)
I chose hosts over paths for disambiguation because I want the request passed to the proxy to be as close as possible to that passed to the browser.
Re:Browserver: a node.js HTTP server, in your browser by BrendanEich on Sunday August 12, 2012 @03:59AM (#4372137)
Also you get same-origin protection, FWIW.
Re:Browserver: a node.js HTTP server, in your browser by wamatt on Friday August 10, 2012 @04:36PM (#4368129)
This does sound sort of interesting, but after thinking about it I don't get why this is cool. Can someone explain a practical use case?

How is it different, in practice, from say running a Node.JS on localhost and using localtunnel?

Re:Browserver: a node.js HTTP server, in your browser by quarterto on Friday August 10, 2012 @11:50AM (#4366671)
Simple question: how the fuck?
Re:Browserver: a node.js HTTP server, in your browser by mcantelon on Friday August 10, 2012 @12:55PM (#4367030)
Basically a web browser reaches the Node HTTP server and gets assigned a throwaway hostname on the Node server. The browser and the server have a bidirectional connection (probably WebSocket via Socket.io or something). The throwaway hostname can be queried, via an HTTP API, and will, upon request, query the web browser through the bidirectional connection then will relay the results back.
Re:Browserver: a node.js HTTP server, in your browser by ivix on Saturday August 11, 2012 @06:21PM (#4371157)
Yeah, it's not quite a HTTP server, more of an API-driven backend to a HTTP server. Still neat.
Re:Browserver: a node.js HTTP server, in your browser by brettbergeron on Friday August 10, 2012 @12:49PM (#4366997)
mind = blown
Re:Browserver: a node.js HTTP server, in your browser by ericz on Friday August 10, 2012 @12:37PM (#4366926)
I find this title rather misleading. There is no node.js HTTP server in your browser. Meaning, you cannot do anything that is part of Node.js in the browser "server"

The browser is still running its original js engine with none of the Node goodies. It merely receives proxied requests, does some stuff to it, then sends it back to the proxy, which returns it to the client.

Re:Browserver: a node.js HTTP server, in your browser by jedschmidt on Friday August 10, 2012 @12:51PM (#4367007)

    It merely receives proxied requests, does some stuff to it, then sends it back to the proxy, which returns it to the client.
You just described the majority of the web servers that we web developers deal with. Sure, it's a proxy, but the fact that the machine responding is connected via WebSocket and not a local network doesn't make it any less of a server, in my opinion.
Re:Browserver: a node.js HTTP server, in your browser by arturadib on Friday August 10, 2012 @12:42PM (#4366959)
The title might be a little too ambitious, but it is partially justified as the HTTP handler in the client (browser) has a Node-like API, see:

https://github.com/jed/browserver-client#example

Re:Browserver: a node.js HTTP server, in your browser by arunoda on Friday August 10, 2012 @11:54AM (#4366692)
Nice attempt. But your title is misleading.

You just listen for a URL and forward it to the browser with socket.io (Pusher, Pubnub are some commercial services for this)

If I can change some content in your webpage by just curling localhost, I can judge the title you put :)

Re:Browserver: a node.js HTTP server, in your browser by e12e on Friday August 10, 2012 @12:39PM (#4366938)
So, it's not a new take on POW (plain old webserver): https://addons.mozilla.org/en-us/firefox/addon/pow-plain-old... which apparently have been abandoned, and could use a fork (source at: http://davidkellogg.com/pow/ )?

Apparently there's a newer variation at:

  https://addons.mozilla.org/en-US/firefox/addon/browser-server/
and of course there's Opera's Unity.

I do get that the idea is that it "just" uses javascript (the server appears to be down, so I'm actually guessing) -- but when such projects already exist, I kind of expected more...

Re:Browserver: a node.js HTTP server, in your browser by arunoda on Friday August 10, 2012 @12:44PM (#4366971)
I thing they use some kind of native addon (I don't know how FF addon works) to do this.

Unfortunately Chrome's native client(NaCl) does not support TCP yet! So I think something like this impossible in chrome? Any ideas?

Re:Browserver: a node.js HTTP server, in your browser by simonster on Friday August 10, 2012 @01:03PM (#4367072)
POW is presumably written in JavaScript using Mozilla's asynchronous socket APIs. I've written a similar HTTP server before.

Chrome has a JS socket API for extensions as well, but it doesn't currently support TCP listening.

Re:Browserver: a node.js HTTP server, in your browser by arunoda on Friday August 10, 2012 @01:21PM (#4367175)
Great. Thanks for the info.
Re:Browserver: a node.js HTTP server, in your browser by shurane on Friday August 10, 2012 @11:55AM (#4366700)
So he still needs to host something that forwards information to the browser? Shucks.
Re:Browserver: a node.js HTTP server, in your browser by poundy on Friday August 10, 2012 @12:35PM (#4366918)
Yes, he needs to have a Node/Socket.io server somewhere.
Re:Browserver: a node.js HTTP server, in your browser by jedschmidt on Friday August 10, 2012 @12:05PM (#4366751)
Indeed, this isn't entirely original, and I know services like this exist. To me, this is what PUSHER's API _should_ have been.
Re:Browserver: a node.js HTTP server, in your browser by aba_sababa on Friday August 10, 2012 @12:38PM (#4366929)
I don't really see why this is special. It's just a websocket connection that happens to show every request made to the server. Your browser is not a server, no matter which way you cut it.
Re:Browserver: a node.js HTTP server, in your browser by andrewmunsell on Friday August 10, 2012 @01:15PM (#4367140)
Sure it is. Yes, the web socket connection is passing through requests to the browser-server, but that browser-server is the one responding.
Re:Browserver: a node.js HTTP server, in your browser by state on Friday August 10, 2012 @12:18PM (#4366819)
I think there's a ton of unrealized potential in this kind of thinking. Although people will say 'But that was done by X a year ago!' I see that as evidence that this is gaining momentum.

Now, what's the project that will fully take advantage of this kind of thing?

Re:Browserver: a node.js HTTP server, in your browser by shaunxcode on Friday August 10, 2012 @12:29PM (#4366882)
A lot of times it is about coming up with the right terminology and positioning of an idea for it to "take off". This is a really nice approach in that it utilizes concepts/a paradigm we are already comfortable with.
Re:Browserver: a node.js HTTP server, in your browser by state on Friday August 10, 2012 @12:32PM (#4366899)
Yeah, agreed. Seems like one of the best things about this is that it positions a (potentially) big idea in a way which makes it easily understandable and fairly everyday.
Re:Browserver: a node.js HTTP server, in your browser by tom_m on Friday August 10, 2012 @12:54PM (#4367023)
I mean yes, you never know what it will be used for. It may not be anything by itself, but combined with a dozen other things it may be critical for something clever. That's what I love about the internet - it's a massive jigsaw puzzle.
Re:Browserver: a node.js HTTP server, in your browser by Xurinos on Friday August 10, 2012 @01:42PM (#4367266)
My hope is an answer to this problem that is so easy that my computer-phobic grandmother can do it: https://xkcd.com/949/
Re:Browserver: a node.js HTTP server, in your browser by pbhjpbhj on Friday August 10, 2012 @03:41PM (#4367857)
I think the Opera Unity approach is probably the best for this; perhaps such peernets will have their day.

I see the Unity approach being popularise via social networking (https://alicious.com/opera-about-to-change-the-world/) enabling users to retain control over their data and shop for suppliers to present a front-end to unify the data-streams of their associates.

Re:Browserver: a node.js HTTP server, in your browser by mcantelon on Friday August 10, 2012 @01:08PM (#4367094)
Weinre is a project that, if my understanding of it is correct, leverages the same basic idea. It's used to remotely debug mobile browser issues and also uses Node.

https://github.com/apache/incubator-cordova-weinre

http://www.youtube.com/watch?v=4nL6xey13fE

Re:Browserver: a node.js HTTP server, in your browser by VikingCoder on Friday August 10, 2012 @12:40PM (#4366947)
...I'm looking forward to WebRTC, which should make this obsolete, right?

http://www.webrtc.org/

That said, this is cool!

Re:Browserver: a node.js HTTP server, in your browser by jmspring on Friday August 10, 2012 @03:54PM (#4367931)
Webrtc is about realtime communications. This is about exposing webhooks clientside.
Re:Browserver: a node.js HTTP server, in your browser by VikingCoder on Saturday August 11, 2012 @12:51AM (#4369477)
It also allows direct client-to-client communications.
Re:Browserver: a node.js HTTP server, in your browser by vitno on Saturday August 11, 2012 @09:26PM (#4371519)
not yet arbitrary data. The protocol is also really hairy, I recommend using https://github.com/webRTC/webRTC.io
Re:Browserver: a node.js HTTP server, in your browser by quarterto on Friday August 10, 2012 @11:45AM (#4366624)
It's not just you! http://browserver.org looks down from here.
Re:Browserver: a node.js HTTP server, in your browser by quarterto on Friday August 10, 2012 @11:49AM (#4366654)
And back.
Re:Browserver: a node.js HTTP server, in your browser by quarterto on Friday August 10, 2012 @11:49AM (#4366663)
Kind of. Servers are 502ing.
Re:Browserver: a node.js HTTP server, in your browser by Kilimanjaro on Friday August 10, 2012 @02:40PM (#4367553)
Just add a text area and let people share some html. Now that would be cool!

Change some HTML in that text area and refresh automatically in all listeners.

That would be an interesting toy to play for a while.

Re:Browserver: a node.js HTTP server, in your browser by sehrope on Friday August 10, 2012 @11:48AM (#4366647)
Anyone know if browserver.org is self hosting (i.e. running on some guys desktop/laptop in a browser window)? Site is down at the moment and I'm wondering if this is why.
Re:Browserver: a node.js HTTP server, in your browser by jedschmidt on Friday August 10, 2012 @11:50AM (#4366672)
Ha, tinco beat you to that joke. The server is the smallest instance that Joyent offers right now... hopefully it'll hang in there during the HN rush.
Re:Browserver: a node.js HTTP server, in your browser by withjive on Friday August 10, 2012 @01:13PM (#4367134)
Would that happen to be one of the free http://no.de instances? Which if I recall correctly come with 128mb ram on their custom solaris servers... I always wondered what kind of load those small configurations using NodeJS while handling something non-trivial could do.

Could you share some traffic/load numbers from getting HN'ed?

Re:Browserver: a node.js HTTP server, in your browser by jedschmidt on Friday August 10, 2012 @01:27PM (#4367197)
Hard to tell right now... I started at Joyent's smallest node.js offering (1GB) and then ramped it up to 8GB when the load hit. The server is crashing a lot, but it's not very easy for me to debug right now.

Let me get back to you once the dust settles, deal?

Re:Browserver: a node.js HTTP server, in your browser by withjive on Friday August 10, 2012 @11:01PM (#4369272)
Wow must of took a real hammering from being on the number spot. Goodluck!
Re:Browserver: a node.js HTTP server, in your browser by mgurlitz on Friday August 10, 2012 @11:52AM (#4366680)
Github has a good readme if this site doesn't stay up: https://github.com/jed/browserver-node
Re:Browserver: a node.js HTTP server, in your browser by jedschmidt on Friday August 10, 2012 @11:53AM (#4366690)
Good point. I'll get to githubbing the browserver.org site itself now.
Re:Browserver: a node.js HTTP server, in your browser by jedschmidt on Friday August 10, 2012 @01:28PM (#4367204)
Re:Browserver: a node.js HTTP server, in your browser by alan_cx on Friday August 10, 2012 @01:07PM (#4367089)
Ok so I can access it either, but:

Loading the app... If this message doesn't go away within 10 seconds, it means that the server crashed under heavy load. Please refresh mercilessly.

:)

Re:Browserver: a node.js HTTP server, in your browser by mislav on Friday August 10, 2012 @11:36AM (#4366579)
Mind-bending.
Re:Browserver: a node.js HTTP server, in your browser by rip_kirby on Friday August 10, 2012 @03:53PM (#4367926)
If you look at the favicon, there's two of them faviconception
Re:Browserver: a node.js HTTP server, in your browser by sharps_xp on Friday August 10, 2012 @01:48PM (#4367289)
I do not understand what is going on.
Re:Browserver: a node.js HTTP server, in your browser by debacle on Friday August 10, 2012 @11:45AM (#4366626)
And they're down.

It was a good 15 minutes, though.

Re:Browserver: a node.js HTTP server, in your browser by tinco on Friday August 10, 2012 @11:46AM (#4366632)
I bet they closed their window >_>
Re:Browserver: a node.js HTTP server, in your browser by shawndumas on Friday August 10, 2012 @05:29PM (#4368358)
෴
Re:Browserver: a node.js HTTP server, in your browser by bestest on Friday August 10, 2012 @02:21PM (#4367454)
What sorcery is this!
Re:Browserver: a node.js HTTP server, in your browser by napolux on Friday August 10, 2012 @02:18PM (#4367433)
We put a server in your browser. #inception
Re:Browserver: a node.js HTTP server, in your browser by mekwall on Friday August 10, 2012 @11:46AM (#4366635)
Hacker News killed it with fire!
Re:Browserver: a node.js HTTP server, in your browser by thefox on Friday August 10, 2012 @02:02PM (#4367364)
Yes, still down.