Build Cross Platform Interactive Polls with Net and Mqtt Boa319

Title

AWS re:Invent 2022 - Build cross-platform interactive polls with .NET and MQTT (BOA319)

Summary

  • The session covered building a cross-platform interactive poll application using a combination of .NET, .NET MAUI, Blazor Web Assembly, AWS IoT Core, AWS Lambda, Amazon DynamoDB, and AWS AppSync.
  • The idea originated from a need to engage attendees at AWS re:Invent with an icebreaker activity.
  • The application architecture involved tablets for voting, sending MQTT messages to AWS IoT Core, which then triggered AWS Lambda functions to process the votes and store them in Amazon DynamoDB.
  • DynamoDB Streams and Lambda were used to update vote counts, which were then displayed on a live dashboard querying data from AppSync.
  • The front-end was built using .NET MAUI and MQTT for resilient communication, even with inconsistent network conditions.
  • Security was implemented using X509 certificates, but the preference for future development would be Amazon Cognito for user credentials.
  • The backend was developed using C# with AWS Lambda functions and DynamoDB for storage and real-time updates.
  • The live dashboard was a single-page web application built with Blazor WebAssembly, using MudBlazor and Plotly.Blazor for UI components and charts.
  • GraphQL subscriptions were used for real-time updates, with a custom WebSocket protocol implemented to interact with AWS AppSync.
  • The session included a walkthrough of the code and the challenges faced during development.
  • Future improvements would include user authentication, monitoring with CloudWatch and X-Ray, automated testing, and a build and deployment pipeline.

Insights

  • MQTT was chosen for client-to-backend communication due to its resilience in environments with inconsistent network connectivity, such as expo halls.
  • The use of MQTT-Net library and managed client extension simplified the implementation of MQTT in the application.
  • The backend for frontend pattern allowed for isolated development across different geographic locations and client types.
  • The use of DynamoDB Streams for real-time updates and the integration with AWS Lambda functions showcased the power of AWS services for serverless, event-driven architectures.
  • Blazor WebAssembly enabled the creation of a web application without the need for extensive JavaScript knowledge, leveraging C# skills instead.
  • The use of GraphQL subscriptions and a custom WebSocket protocol demonstrated the flexibility of AWS AppSync and the ability to extend existing libraries to meet specific requirements.
  • The session highlighted the importance of considering security, observability, and deployment practices in application development, even for demo applications.
  • The code and resources shared during the session can serve as a valuable starting point for developers looking to build similar applications on AWS using .NET technologies.