node.js

Get and Set a Single Cookie with Node.js HTTP Server

I want to be able to set a single cookie, and read that single cookie with each request made to the nodejs server instance. Can it be done in a few lines of code, without the need to pull in a third party lib? var http = require('http'); http.createServer(function (request, response) { response.writeHead(200, {'Content-Type': 'text/p...

Node.js and Web Sockets

Hello, I've got a node.js server running and I can get it to show "hello world" or a twitter feed when I navigate to the url. Issue is I cannot get any communication to happen between the node.js instance and the websocket defined on the client of another page. Does anyone have any ideas? Thanks so much. ...

node.js multi room chat example

I'm looking for a websocket/node.js chat implementation which supports multiple rooms. I'm also going to write an app which needs multiple rooms or servers, and I'm just looking for some code samples of how people do it. Thanks. I know there's a service http://pusherapp.com which provides this service, but I'm looking for an open sour...

Is there a Java equivalent of node.js

Does any body knows a Java equivalent of node.js? Thanks! ...

Executing MongoDB query in Node.js

I am trying to execute this MongoDB command in Node.js: db.events.group({ key : { 'timestamp.d' : true }, cond: { 'event_name': 'search' }, initial : { 'count' : 0, 'empty' : 0, 'redos' : 0 }, reduce : function(item, summaries){ summaries.count++; if (item.result_count == 0){ summaries.empty++; ...

node.js: readSync from stdin?

Is it possible to synchronously read from stdin in node.js? Because I'm writing a brainfuck to JavaScript compiler in JavaScript (just for fun). Brainfuck supports a read operation which needs to be implemented synchronously. I tried this: const fs = require('fs'); var c = fs.readSync(0,1,null,'utf-8'); console.log('character: '+c+' ('...

Mongo JSON document -> JSON -> BSON

I am working with Node.js to build a web socket server that uses mongodb. I am using node-mongodb-native as the library to access mongo db. When I call console.log(sys.inspect(item)) on an object from the db I get something that looks like this: { _id: { id: 'L?#&\u008e\u00ad\u000e\u008f\u0014\u0005\u0000\u0000' } , y: 3 , favorite_c...

How to keep Node.js from splitting socket messages into smaller chunks

I've got a chat program which pushes JSON data from Apache/PHP to Node.js, via a TCP socket: // Node.js (Javascript) phpListener = net.createServer(function(stream) { stream.setEncoding("utf8"); stream.on("data", function(txt) { var json = JSON.parse(txt); // do stuff with json } } phpListener.listen("88...

path- and other problems using node.JS and Socket.IO

Hi, I'm using node.JS in VirtualBox on a TurnkeyLinux hosted by Windows. I was following the instructions here. node.JS is living in /root/node. Although I can run simple examples successfully I'm having a hard time figuring out certain things, cause I'm not a Linux-guy normally. I wanted to use socket.io. I managed installing node.JS...

Installing NodeJS on windows machine ?

Hello, How do I Install NodeJS on my windows Machine ?? I Searched All the available blogs for info, I found none of them are useful. so Is it possible for me to install Nodejs on my windows machine. If the answer is yes can anyone please explain the procedure. BTW I'm using windows XP ...

Node.js Websockets Socket.IO

I can't get the client-side events to fire, please see the code/explanation: Okay, so I got this working(I think) Client-side code: <script src="./Socket.IO/socket.io.js"></script> <script> io.setPath('./Socket.IO/'); var socket = new io.Socket('jayz.danstanhope.webfactional.com', { 'port': 80 }); socket.on('connect', f...

How to append to a file in Node?

Hello there, I am trying to append a string to a log file. However writeFile will erase the content each time before writing the string. fs.writeFile('log.txt', 'Hello Node', function (err) { if (err) throw err; console.log('It\'s saved!'); }); // => message.txt erased, contains only 'Hello Node' Any idea how to do this the easy ...

What are the use cases of Node.js vs Twisted?

Assuming a team of developers are equally comfortable with writing Javascript on the server side as they are with Python & Twisted, when is Node.js going to be more appropriate than Twisted (and vice versa)? ...

Can't configure node_chat to localhost

I went to configure server.js but I get the error connecting to server. HOST=localhost; PORT= 80; http://github.com/ry/node_chat ...

Nanite and NodeJS

I'm working on a code that requires to send Nanite requests to actors. Was it possible to publish requests from another amqp client? I'm using http://github.com/ry/node-amqp So basically I wanted to publish nanite commands from a NodeJS app, Here's some code: connection.addListener('ready', function () { puts("connected to " + conne...

Is It possible to compile a latex document via node.js?

I'm new to node.js but I think It could be good for an asynchronous latex compile engine. In other words I'd like to know if could be possible, and how, to compile a document via node.js and pdflatex. The remote application would send the document as a JSON data structure, toghether with a template name for the end document layout. Th...

Node.js web sockets server: Is my idea for data management stable/scalable?

Hi, I'm developing a html5 browser multi-player RPG with node.js running in the backend with a web sockets plug-in for client data transfer. The problem i'm facing is accessing and updating user data, as you can imagine this process will be taking place many times a second even with few users connected. I've done some searching and fou...

Javascript eval() Exception - line number

In JavaScript I have a var str = ".a long string that contains many lines..." In case of exception that caused by eval(str); I had like to catch it and print the the line number that caused the exception. (the line internal to str..) Is it possible? EDIT As part of the Alligator project (http://github.com/mrohad/Alligator), an applica...

Node.js and CPU intensive requests

I've started tinkering with Node.js HTTP server and really like to write server side Javascript but something is keeping me from starting to use Node.js for my web application. I understand the whole async I/O concept but I'm somewhat concerned about the edge cases where procedural code is very CPU intensive such as image manipulation o...

user authentication libraries for node.js?

Are there any existing user authentication libraries for node.js? In particular I'm looking for something that can do password authentication for a user (using a custom backend auth DB), and associate that user with a session. Before I wrote an auth library, I figured I would see if folks knew of existing libraries. Couldn't find anythi...