The browser based game http://www.ninjawars.net has a chat that I developed a few years ago that is purely EC2 server based. The background websockets server of the chat is run directly off of a debian EC2 server. These days, I write stuff in serverless AWS and often use AppSync. So I thought it was high time to convert this chat from using a custom websockets backend to using the AWS appsync subscription approach for a different method of real-time updates.
Right now, the way the chat works is:
- It initializes with the chats that are already in the system from the database
- When a user sends a new chat, it instantly sends that as some json to the websockets server
- the websockets server broadcasts the message to other browser clients, which append the chat to the chat area
However, the websockets server is based on a php package http://socketo.me/ , and sometimes that mini-app goes down without warning, leaving the chat to fallback to an old-school chat-archive. Even monitoring and being certain that the chat websocket server is -up- isn't obvious.
Ok, so that's the previous approach with websockets, what will the version 2 be like?
Well, having used amplify + DynamoDB + Datastore, Datastore makes it simple to pull data and send up data in an offline-app compatible way, as well as having a subscription to new incoming data. So first attempt is going to be using DynamoDB, Amplify, and Datastore, generally ignoring auth for the purposes of this simple app, for now.
I'm working on the architecture for this, more on the results and modifications to come in part 2!