Though, now you can't make certain types of sockets in browser...
Chrome extensions have an API called Native Messaging which is roughly the postMessage API over stdin/stdout. It works, but isn't cross-browser. Alternatively, you can start up a local server and make XHR or WebSocket calls to localhost. However, both of those require the user going through an external install process. Maybe, in the current security landscape, that's the way it has to be, but it's kind of annoying.