Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Reliable way to wrap Node.js+Socket.io into OSX executable? (or C/C++/Objective-C libraries to use as alternatives)

Reliable way to wrap Node.js+Socket.io into OSX executable? (or C/C++/Objective-C libraries to use as alternatives)

Problem

I'm working on a project that needs a simple, lightweight event server (i.e. a server that passes events between different client applications implemented in Javascript). At first Node.js and Socket.io seemed like the perfect solution but the amount of dependencies and config involved took some of the shine off (see below for details on the project and why configuration is an issue). Is there some tested and reliable way to package all those dependencies into a single executable that can be run with no additional configuration? If not are there any good C/C++ Websockets libraries that could be combined with something like Mongoose to create a standalone executable?

Project Details

Basic use case:

  • A moderator turns on the server on their OSX machine.
  • A group of 10-20 users point their mobile devices to a site hosted on the moderator's machine
  • Communication ensues for the duration of the session (about an hour)

Basic requirements:

  • Simple setup: The moderator will not be a developer and may have little to no technical expertise. Anything that requires the terminal or fiddling with configuration files or package managers is a non-starter.
  • Unreliable Configuration: The moderator's machine will be used in a lot of different contexts and by a lot of different users. Therefore the system shouldn't rely on very specific or pristine settings (i.e. would like to avoid something with lots of dependencies that requires special environment variables to be set)
  • Performance and security are not a concern: The server will run locally with small number of trusted users for a short time so security and high performance aren't important.
Problem courtesy of: Mattia

Solution

Interesting question.

I know there are some C and/or C++ WebSocket libraries under development in the WebSocket community (mentioned on the IETF discussion list) if you want to go in that direction.

It might interest you to know that some parts of Node.js are actually written in javascript and compiled during the build process as built-in modules, but I don't know of any way to accomplish that for your own code short of hacking up the build.

Since this is OSX you could package Node alongside your own code and any modules, built against a static v8 library, in your .app. This would be a fairly tight coupling though not quite what you are asking for.

It's also possible to build your extension (or part of it) as a C++ module loaded by Node and v8.

Solution courtesy of: Timothy Meade

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

Reliable way to wrap Node.js+Socket.io into OSX executable? (or C/C++/Objective-C libraries to use as alternatives)

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×