A progressive Node.js framework for building efficient and scalable server-side applications.
Chat API
createPost
Mutation emits anew.post.requested
message toposts
queue at RabbitMQ and returnssuccess: true
to the client;new.post.requested
consumer emits anew.post.accepted
with post params (author, body, roomId and userId);new.post.accepted
consumer creates the post at the DB and emits anew.post.created
message at afanout
RabbitMQ exchange (Pub/Sub) making sure all running server instances receive it;- The
postCreated
Subscription is listening fornew.post.created
messages and when a new message is consumed, the connected clients that are listening to the correspondent roomId are notified of a new message via the WebSocket connection.
createPost
Mutation emits anew.post.requested
message toposts
queue at RabbitMQ and returnssuccess: true
to the client;new.post.requested
consumer emits abot.command.received
with a signed JWT that is valid for only 5 minutes and the post params (author, body, roomId and userId
);- The Bot consumes the
bot.command.received
, calls the Stooq API and if the processing is successfull and data is valid, the bot emits a message with the formatted post params tobot.post.request
; - The
bot.post.request
consumer validates the data, and if everything is fine, emits a message tonew.post.accepted
with post params (author, body, roomId and userId
); new.post.accepted
consumer creates the post at the DB and emits anew.post.created
message at afanout
RabbitMQ exchange (Pub/Sub) making sure all running server instances receive it;- The
postCreated
Subscription is listening fornew.post.created
messages and when a new message is consumed, the connected clients that are listening to the correspondentroomId
are notified of a new message via the WebSocket connection.
createPost
Mutation emits anew.post.requested
message toposts
queue at RabbitMQ and returnssuccess: true
to the client;new.post.requested
consumer emits abot.command.received
with a signed JWT that is valid for only 5 minutes and the post params (author, body, roomId and userId
);- The Bot consumes the
bot.command.received
, calls the Stooq API and if the processing is not successfull or data received is not valid, the bot emits a message with the original post params tobot.post.request
+error=true
; - The
bot.post.request
consumer validates the data, and if everything is fine, buterror=true
, it emits a message tonew.post.error
with original post params (author, body, roomId and userId
); - The
new.post.error
consumer emits anew.post.error.notify
message at afanout
RabbitMQ exchange (Pub/Sub) making sure all running server instances receive it; - The
postError
Subscription is listening fornew.post.error.notify
messages and when a new message is consumed, the connected clients that are listening to the correspondentuserId
are notified of a new message via the WebSocket connection.
$ yarn
$ yarn start
After running, the GraphQL Playgroung is available. Open http://localhost:4100/graphql to view it in the browser after running.
# unit tests
$ yarn test
# test coverage
$ yarn test:cov