During Lockdown, a group of friends and I started getting together weekly, to play a board game using an online board game table, also known as a Virtual Tabletop (VTT). All the players can see a table, move pieces, and the current state of the table is synchronized for all players. The problem we ran into was with the performance of this VTT. Following an investigation, I discovered the VTT was using polling to retrieve data from the server. Periodically each client (player) would check with the server and if there had been any updates, the server would then send the updates to the client.
We had one player in Japan, one in Sweden and the rest were living in Ireland. Each move was taking over a minute to register the event with the server and update all the clients.
I decided to develop my own solution, with a focus on performance. I achieved this improvement in performance using Server-Sent Events. Server-Sent Events is a server push technology that enables a client to receive automatic updates from a server via HTTP. I developed my own VTT web app using HTML 5 Canvas/JavaScript for the Client-Side and NodeJS for the Server.
Server-Sent Events
Server-Sent Events allow data to be sent from server to client without the need for polling, The client creates a listener object, which waits for server data and triggers a function when data is received.
The key benefit is increased performance due to the reduction of data transmission. A drawback is that data can only be sent one way. Server -> Client. To send client data to the server I used a REST API.
Client
The client consisted of a HTML Canvas on which players could add various shaped pieces, players could also move, rotate and change the size of pieces. Any client interaction called a REST API, passed in details of the move, resize, rotation, etc.
Server
The sever is a NodeJS App hosted in Azure, the main job of the server is to maintain the current state of the game, the position, orientation and size of each piece. The server has REST APIs that when called, update the details of a particular piece. The server then sends the update to all the clients connected.
Conclusion
I began this project with performance being the goal, and I achieved this. Due to Azure Hosting and a reduction in the amount of data transmitted, the time to register updates was reduced from 1 minute to less than 10 seconds.
For all your Software Development needs please contact Aspira here.


Alan Lehane, Aspira Software Developer
Alan has been working with Aspira for 4 years as a Software Developer, specializing in Data Analytics & Machine Learning. He has provided a wide variety of services to Aspira’s clients including Software Development, Test Automation, Data Analysis & Machine Learning.
Related Blogs


Can Project Managers manage people?
Can Project Managers, manage the people? The task of a Project Manager is to ensure that the project goals are met on time. This cannot be done alone and he/she


Essential PMO Services – People & Process
In our previous blogs ‘What is a PMO and do you need it? ’ and ‘PMOs Influence and Position’ it was highlighted that every PMO is a unique journey and


Mastering Soft Skills: The Key to Successful Project Management
We all recognise the value of hard skills. It’s the hard skills that allow us to become known for certain technical competencies in our chosen profession. However, with the ever-changing


The role of the Scrum Master
The Scrum Master role is a crucial one in Agile projects and is probably the best-known role thanks to its catchy title. The primary responsibility of the role is to


The Developer’s Role in Agile Projects
As an experienced Agile developer, I have had the opportunity to work on a variety of projects, both in Agile and waterfall environments. I have seen first-hand the benefits and


Project Management – Which Approach is Better?
The world is crazy busy and constantly evolving and so are the companies that we work for. Recently, companies are beginning to recognise the need for change when it comes