I have a chatbot that runs on different platforms (web, messenger, telegram etc.) with almost the same logic. It was initially written using node.js express (JavaScript) and socket.io. I'm working on the app refactoring now, adding more bot platforms, unit tests and transitioning to TypeScript. I have very little experience with sockets and not sure what the new architecture should be.
My initial architecture was:
- API app that had all the bot logic and was communicating with all the platform-client apps through sockets;
- Facebook Messenger client-server app that was getting user input then sending it through sockets to API, and receiving message events from API, then rendering them;
- And the Web client that was the same as Messenger client, but for web.
Then DevOps asked me to combine Facebook client and API app in one (to reduce the heroku app instances), which I did. So now I have an node.js app where different parts communicate through sockets and I'm not sure if I should keep that way or rewrite. And if I should re-write it then how? I have to keep the sockets communication at least for the web app.
I also need to add 3 more platforms and some of them having a somewhat high load (up to 20k users a day), so I probably should keep the possibility to split my large server app into the separate ones.
What would be a good architecture in my case?
via Alena Gilevskaya
No comments:
Post a Comment