Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gipsh/sam-websocket-boilerplate

aws serverless boilerplate for a websocket app in golang
https://github.com/gipsh/sam-websocket-boilerplate

Last synced: 9 days ago
JSON representation

aws serverless boilerplate for a websocket app in golang

Awesome Lists containing this project

README

        

# sam-websocket-boilerplate

Example websockets application using lambdas and api gateway on AWS

![alt text](https://github.com/gipsh/sam-websocket-boilerplate/blob/master/aws-ws-bp.png)

## How it works

The app defines 3 lambda functions for handling the main events of a websocket service:

- Connections: when a new client connects the `connectHandler` is called and the connection is added
on the dynamodb table

- Disconnections: when a client disconnects the `disconnectHandler` removes the entry from dynamodb

- Message received: when a message arrives to the service the `defaultHandler` is called and first uses
the api-gateway inerface to answert to the client and then retrieves the connections from dynamodb and updates
the array with new messages.

## Deploy

Compile first

```bash
make
```

And then just use serverles to deploy
```bash
serverless depoy
```