Member-only story

Getting started with WebSockets on API Gateway with .NET and the Serverless Framework

Gavin Lewis
9 min readApr 26, 2019

We have some projects coming up at work which have the requirement of real-time data being pushed between devices. I’ve been eyeing off WebSockets on API Gateway for some time and now seemed like a great opportunity to get my hands dirty and give it a go. Whenever I make a recommendation for a solution to our teams, I like to know how the service works and it’s intricate details so I provide pointers and in-depth details to our developers who will ultimately be implementing my recommended solution.

The other part of experimenting with WebSockets was writing the code for Lambda in .NET as most tutorials I found were written in nodeJS. Thanks to Norm Johanson @ AWS for his port to .NET as a base for what I used to get started.

How Does WebSockets Work?

For those not familiar with WebSockets, WebSockets allow a device to create a connection between itself and a remote service which can be used to send and receive data real-time. The connection remains open allowing data to traverse until such time either end closes the connection.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Gavin Lewis
Gavin Lewis

Written by Gavin Lewis

Passionate about building and delivering solutions in the Cloud! Principal Cloud Architect @ Rapid Circle. Views are my own.

Responses (1)

Write a response

Gavin, thank you for putting this amazing post together. Do we need to create 4 different lambdas (one for each handler connect, disconnect, echo and default) and link them to one API Gateway end points? Also if you can elaborate little more about…

--