You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to know , is it bad to use Synchronous way , in express js server? is there any benefit with Asynchronous mode? As I think there is no I/O and just CPU usage, So Asynchronous and Synchronous must b same, just syntax is different
Reacted by lonix1, Dave Welsh, Shahin, Diwakar, Osama Shegem, Dmitrii Korostelev, Marek Lukáš, Youssef Gabr, Sachith Muhandiram, Tim Rohrer and 5 more
@wjureczkaPracuj as I understand, in point of performance there is no different I use sync or async mode, and it is safe to use sync mode in server too
If there is no perf difference, why does the library offer an async alternative?
Reacted by K_Maruschak, vladilsav10, Travis, Marek Lukáš, BoaglioFranco, Luis Antonio Canettoli Ordoñez, Tiago Salema, Hlaing Min Than(Faizal), Shane Brinkman-Davis Delamore, Mikael Finstad and 1 more
TL;DR; To allow consumers load keys from filesystem or any other source of ReadStream without blocking event loop. Not to actually perform the signing.
I've been digging into git history and jws implementation to understand why the library provided the async functionality for signing:
On this library we supported both streams until v7.4.3 -> v8.0.0 where we lost compatibility with stream payload ( not known breaking change 🎉 😞, I just updated the migration notes v7 -> v8 ).
Honestly, not sure if that streaming is a desired feature by consumers, we'd need to update the README to make it clear.
Reacted by lonix1, vlaurenzano, Wojciech Jureczka, Ivo Raisr, Randy Creasi, Travis, christoph trybek, Shahin, Joseph KM, Laurents Mohr and 22 more
Reacted by sm2017, Ivo Raisr, Henrique Silvério, Randy Creasi, Travis, Juan José Sosa Osuna, Joseph KM, Laurents Mohr, Quinn Chaffee, Emin and 4 more
Reacted by Ivo Raisr, Randy Creasi, Travis, Laurents Mohr, Don L., Vitor Santana and Léandre Daumont
Activity
sm2017 commentedon Jan 13, 2019
@ziluvatar , @MitMaro can you help me?
sm2017 commentedon Jan 15, 2019
Hello???????????
sm2017 commentedon Jan 17, 2019
:-((
wjureczkaPracuj commentedon Jan 17, 2019
https://medium.com/@patrykcieszkowski/jwt-authentication-in-express-js-ee898b87a60 section Verifying the Token may help you
sm2017 commentedon Jan 17, 2019
@wjureczkaPracuj as I understand, in point of performance there is no different I use sync or async mode, and it is safe to use sync mode in server too
ziluvatar commentedon Jan 18, 2019
Correct. Although if you use the sync way be sure you wrap it with try-catch.
lonix1 commentedon Feb 11, 2019
If there is no perf difference, why does the library offer an async alternative?
ziluvatar commentedon Feb 15, 2019
TL;DR; To allow consumers load keys from filesystem or any other source of ReadStream without blocking event loop. Not to actually perform the signing.
I've been digging into git history and jws implementation to understand why the library provided the async functionality for signing:
jwsimplemented streaming for sign/verify: auth0/node-jws@ad80a8ajwslibrary provides streaming for payload and secret, that way you could load those from the file system or any source that provided a NodeJS stream interface, like we can see injws: https://github.com/brianloveswords/node-jws/blob/ad80a8ac9fdea2de59b607ea8f556451053af145/test/jws.test.js#L132Honestly, not sure if that streaming is a desired feature by consumers, we'd need to update the README to make it clear.
lonix1 commentedon Feb 15, 2019
@ziluvatar That sounds like some serious coding archaeology... well done! 😉
Update README.md