Real-world use cases for CSP (Communicating Sequential Processes) in JavaScript?

I'm a sucker for trying out new ideas in JS, and have fully jumped on board the ES201X train. I have read about CSP and coroutines in the past (specifically in relation to https://github.com/getify/asynquence) but never really had a go, the syntax was confusing. However, today I came across https://github.com/dvlsg/async-csp, and I can read and understand the syntax and API with great ease. I fully understand how this thing works!

The question is, when and where would this be useful? Can anyone suggest real-world, javascript use cases where CSP and this library would really shine?

Comments (2)

Denny Trebbin's photo

Thanks for the invite.

I can imagine, that all kind message passing systems are good to use for CSP. I'm thinking of state transfers or de-serialisation & serialisation. Something is done on server-side and needs to be continued client-side. Or whatever code will act as a sender and whatever system shall serve as a receiver.

Let's summarise them as universal JavaScript apps.

Ben Styles's photo

So do you mean communicating between a client and an API?