With a node.js powered server on EC2, how can I decrease the TCP connection time?

While profiling my application I’ve noticed that in the Firebug Net panel, the “Connecting” time—that is the time waiting for a TCP connection—is consistently around 70–100ms. See image below: Of course in the grand scheme of things, 100ms is not long, but I have seen other services that respond with 0ms Connect time. So if […]

Everyauth: Check github authentication against a database

I’m pretty new to node.js and I’m having problem with the everyAuth module. My issue is, I am trying to create an app that lets the user login via github oauth and checks to see if the user is whitelisted in the database. I want to stop the authentication returning true until I check the […]

CouchDB filtered replication: Amend doc_id after first complete replication

NPM’s (node package manager) registry uses CouchDB to store meta information and tarballs of packages at a CouchDB instance at http://registry.npmjs.org/registry .. I use the following replication document (CouchDB 1.1.0) to replicate a subset of the registry to my corporate CouchDB: { “_id”: “fetch-npm-registry”, “doc_ids”: [ “coffee-script”, “nodeunit” ], “source”: “http://couchdb.mycompany.com:5984/registry”, “target”: “registry”, } [BTW, […]

Updating embedded document in MongoDB

My documents are structured as follows: {_id: 1, country: ‘USA’, names: [{language: ‘en’, name: ‘New York’, state:’new’}, {language: ‘es’, name: ‘Nueva York’, state:’translated’}]} {_id: 2, country: ‘France’, names: [{language: ‘en’, name: ‘Paris’, state:’new’}, {language: ‘it’, name: ‘Parigi’, state:’translated’}]} … I want to update the state of an item for a specific language, and if the […]

ExpressJS/Node ajax login

Hi I am using the express framework to make a site in node. I am trying to use facebox to present a box where a use can login so that the music on the site will not have to stop playing. I am using mongoose-auth/everyauth for authentication and can’t figure out how this can be […]

socket.io – Catch all event

I’m working on a Node.js application where pretty much all the communication is taking place via sockets.io. What I need to do is, before processing any request (other than the login request) ensure that the user is authenticated. The obvious way to do this would be to have a catch-all listener which is called prior […]

How can I daemonize node?

Is there a universally accepted means of deamonizing (and of course, later communicating through signals or some abstraction thereon) a node script? That is, is there a Node equivalent of: if (fork()) // parent process, die exit(1); // we’re a daemon

How do I upload multiple files directly to Amazon S3?

I am trying to get the Amazon S3 Plupload example working with Node.js. However, so far all I have been able to get is Error #2049. I am not sure what I am doing wrong. I have uploaded the crossdomain.xml file. Here is my policy document and signature: var crypto = require(‘crypto’); var s3 = […]

node.js WebSocket server compatible with Chrome 14+ and with Safari?

I’ve been using the node.js WebSocket implementation from http://github.com/ncr/node.ws.js, but it’s only compatible with the hixie-76 version of the protocol, as implemented by Safari 5.0.1. I also need to work with Chrome, which now implements the official protocol per RFC 6455. Does anyone know a server-side implementation for node.js which is compatible with both hixie-76 […]

Does socket.io broadcast to subscribers only?

Please examine the server-side code below. Assuming that data.id is abc77 at some instant, will every connected browser receive a socket message ‘my_model/abc77:update’, or only the ones that have subscribed to this particular message, regardless of whether the socket.io event is raised or not? To clarify, using a practical application: will a hacker be able […]

Node.js is the Best Javascript runtime in the world.