_CORE
AI & Agentic Systems Core Information Systems Cloud & Platform Engineering Data Platform & Integration Security & Compliance QA, Testing & Observability IoT, Automation & Robotics Mobile & Digital Banking & Finance Insurance Public Administration Defense & Security Healthcare Energy & Utilities Telco & Media Manufacturing Logistics & E-commerce Retail & Loyalty
References Technologies Blog Know-how Tools
About Collaboration Careers
CS EN
Let's talk

Node.js in the enterprise — a bold experiment

30. 10. 2014 1 min read CORE SYSTEMSdevelopment
Node.js in the enterprise — a bold experiment

We are a Java company. But we had a project where Java was not ideal: a real-time dashboard with thousands of simultaneous WebSocket connections. Node.js with its event loop model scales better than thread-per-connection.

Event-driven, non-blocking

var io = require('socket.io')(server);
io.on('connection', function(socket) {
  socket.on('subscribe', function(lineId) {
    socket.join('line-' + lineId);
  });
});

function broadcastSensorData(lineId, data) {
  io.to('line-' + lineId).emit('sensor-update', data);
}

The NPM ecosystem and callback hell

Over 100,000 packages — both a strength and a weakness. Quality varies. Callback hell is solved by Promises; we are waiting for async/await. IDE support is weaker than for Java — WebStorm is the best choice.

Coexistence with Java

Java for business logic and the REST API, Node.js for the WebSocket gateway. Redis pub/sub connects the two runtimes. Each does what it does best.

Polyglot is the future

Node.js is not a Java killer. It is an excellent tool for I/O-intensive scenarios. The key is not to be afraid to use the right tool for the right problem.

node.jsjavascriptreal-timewebsocket
Share:

CORE SYSTEMS

Stavíme core systémy a AI agenty, které drží provoz. 15 let zkušeností s enterprise IT.

Need help with implementation?

Our experts can help with design, implementation, and operations. From architecture to production.

Contact us