Any plan to migrate to Node.js v8.x LTS?

Node.js version 8.x offers a plenty of new features and improvements comparing with version 6. Although most of it is still compatible with older versions which makes the migration easy.

One of the exciting features is async/await function calls. Briefly it enables to write asynchronous code in synchronous way! As an example compare these two code snippets:

N.API.createToken(roomId, name, role, (token) => {
  consume(token);
  // the rest of the code goes here (closure) or in another function
}, (error) => {
  console.error('creating token failed', error);
});
let token;
try {
  token = await Nuve.API.createToken(roomId, name, role);
} catch (error) {
  console.error('creating token failed', error);
}
consume(token);
// the rest of the code goes here so you won't loose the code scope

As you see this way we would get rid of callback functions and write a very cleaner code. Read more about Callback Hell.

1 Like

I rewrote NuveClient code using async/await functions. As you see There is no callback function any more. It’s much cleaner. :sunglasses:

Hi Mohsen

Is not only a node.js update what is needed, have you updated only node.js or you updated some other parts, like the mongo connections/queries or websockets?

Hi

I’ve just updated the nuveClient that has no dependency and is used in the user app. Are saying migrating to Node.js v8 needs mongodb and other parts also to be updated?

No I’m just interesting in the update process, if you have take some steps more in deep on the server side.

I’ve not tested the whole licode against Node.js v8 yet. Actually I expected to get some feedback from the team if there is any concerns about migration and if no then I would like to work on it.