I'm not an expert, but I seem to recollect a web sockets example using
node.js where it built it's own web server and it didn't seem to be a lot
of code.


var http = require("http");
var url = require("url");

function start() {
function onRequest(request, response) {
var pathname = url.parse(request.url).pathname;
console.log("Request for " + pathname + " received.");
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World");
response.end();
}

http.createServer(onRequest).listen(8888);
console.log("Server has started.");
}

exports.start = start;

---

A tutorial would explain it. But you're right. There isn't a need for a lot
of code to create an HTTP server, which is somewhat different than a Web
socket server. And that's part of the appeal of the language / runtime
environment.

That example both creates an HTTP server instance for handling the sockets
and protocol, and responds with simple content.

Nathan.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.