user2105505
user2105505

Reputation: 708

TCP Server for plug-in written in Javascript

I am writing a plug-in for a desktop application that is available on multiple platforms. The makers of this application require that plug-ins are written in HTML and Javascript. I am new to both of these languages, but I have considerable experience in lower-level languages such as C and C++. My plug-in needs to host a TCP server, preferably with Bonjour (zeroconf). I'm looking for ways to accomplish this and this is what I've come up with:

• Use an open-source library. I came across Node.js, but I'm not sure how to include Node.js in my project in such a way that when a user downloads my plug-in, it will be fully functional without the user having to install Node.js.

• Somehow include C/Objective-C code in my .js plug-in. I could access sys/socket.h on the user's machine and maybe CFNetServices or NSNetServices. I would like to avoid this if possible, as not all platforms will have these resources.

Any advice or recommendations would be very helpful. Thanks.

Upvotes: 0

Views: 66

Answers (2)

Jeff Wooden
Jeff Wooden

Reputation: 5489

Node.js is an excellent option and can be packaged. I would elaborate more on this, however, there are answers here that are suitable: Packaging a node.js webapp as a normal desktop app

Upvotes: 1

Lloyd
Lloyd

Reputation: 29668

If this is a HTML/JavaScript plugin then you're probably limited to whatever the hosting environment provides and lets you use. I would bet this is probably restrictive, which means you're unlikely to have access to anything like raw TCP and UDP sockets.

Hard to advise without knowing more about the host though.

Upvotes: 1

Related Questions