1

I've the below code working perfectly with Dart, interested to have similar one with NODE, using PURE NODE modules, as I'm interested to check the performance of my app in Dart if it was written in JavaScript in client and NODE in server.

I do not want to use any third party package like socket.js or whatever.

import 'dart:io';

 void main() { 
  HttpServer.bind(InternetAddress.ANY_IP_V4, 8080).then((HttpServer server) {
    print("HttpServer listening...");
    server.listen((HttpRequest request) {
      if (WebSocketTransformer.isUpgradeRequest(request)){
          WebSocketTransformer.upgrade(request).then(handleWebSocket);
       }
  else {
        print("Regular ${request.method} request for: ${request.uri.path}");
        serveRequest(request);
        }
    });
 });
}   

any thought how to write same code in NODE, using PURE NODE modules without any third party module/package?

2
  • Any thought on what? What are you asking? Feb 3, 2015 at 13:16
  • how to write same code in NODE, using PURE NODE modules without any third party module/package? Feb 3, 2015 at 13:17

1 Answer 1

0

I found no way to create it with pure node, so I started using the Faye npm as a best module I found for using both web-socket and Server-Sent Event (SSE)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.