Skip to content
Serverless WebRTC Signaling Server only works for WebRTC P2P.
Go Makefile
Branch: master
Clone or download
hakobera Merge pull request #12 from hakobera/feature/support-custom-domain
Support custom domain name for API Gateway
Latest commit ad996f3 Mar 18, 2019



This is the code and template for the serverless-webrtc-signaling-server. There are five functions contained within the directories and a SAM teamplte that wires them up to a DynamoDB table and provides the minimal set of permissions needed to run the app.

What is Serverless WebRTC Signaling Server?

Serverless WebRTC Signaling Server is Signaling Server for WebRTC using WebSocket and running on AWS. This signaling server only works for WebRTC P2P.

This signaling server implements room feature compatible with WebRTC Signaling Server Ayame. Room feature is simple, so only 2 people can join a room.

If you want to know how this server works, refer to (written in Japanese)

Setup process on Local Machine


Installing dependencies

This repository use GO Modules to manage dependencies. Dependencies are automaticaly download when you build code by make build command.


Golang is a statically compiled language, meaning that in order to run it you have to build the executable target.

You can issue the following command in a shell to build it:

make build

Local testing

Unit Testing

We use testing package that is built-in in Golang and you can simply run the following command to run our tests:

make test

Integration Testing

Unfortunatelly sam CLI does not support WebSocket local test. So you need to deploy to test functionality. We are planing to write local integration test using Local Stack, but not yet implemented.

Packaging and deployment

First and foremost, we need a S3 bucket where we can upload our Lambda functions packaged as ZIP before we deploy anything - If you don't have a S3 bucket to store code artifacts then this is a good time to create one:

aws s3 mb s3://BUCKET_NAME

Next, create file named .env using cp .env.template .env command. Then open the file in your editer and set S3 bucket name which you created to SAM_BUCKET.

# Must need to change

# Change if you want 

At last, run the following command to package our Lambda function to S3:

make deploy

See Serverless Application Model (SAM) HOWTO Guide for more details in how to get started.

After deployment is complete you can run the following command to retrieve the API Gateway Endpoint URL:

make describe-stack

Connect to API Gateway Endpoint URL using wscat (WebSocket CLI client)

$ npm instal -g wscat
$ wscat $(make describe-stack | jq -r '.[][] | select(.OutputKey == "WebSocketURI") | .OutputValue')


Apache License 2.0

You can’t perform that action at this time.