node.js with a statemachine

2019-06-23 07:12发布

I understand that node.js is a single thread and is a single process in the memory, I'm working on a project employing state machine and wondering how that will work in this context. I'm feeling the states will be shared across users because it's a single thread or a single process. Calling out for directions/advices.

let's say I've state A, state B, state C

Application can only transition in this sequence, A -> B -> C

Initial state is A,

user 1 requests and as a result the state machine moves to state B and then finally state C

user 2 requests, will the state machine for this new user be in state A or state C?

2条回答
爱情/是我丢掉的垃圾
3楼-- · 2019-06-23 07:26

If you know about Stateless C# and experience, you can use Stateless npm porting for TypeScript/JavaScript: https://www.npmjs.com/package/stateless

查看更多
登录 后发表回答