Node.js with station station

I understand that node.js is a single thread and is a single process in memory, I am working on a project using a state machine and wondering how it would work in this context. I feel like the states will be shared between users because it is one thread or one process. Call for instructions / advice.

say i have state A, state B, state C

The application can go only in this sequence, A → B → C

Initial state: A,

user 1 request and as a result the state machine goes into state B and then finally state C

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

+3


source to share


2 answers


This article presents a very interesting approach to how to deal with the FSM abstraction in an event-driven environment.

http://www.robert-drummond.com/2015/04/21/event-driven-programming-finite-state-machines-and-nodejs/



See also:

+5


source


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



0


source







All Articles