serverless-webrtc-signaling-server

Serverless WebRTC Signaling Server only works for WebRTC P2P.

Github星跟踪图

CircleCI

serverless-webrtc-signaling-server

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 https://github.com/shiguredo/ayame/blob/develop/doc/DETAIL.md (written in Japanese)

Setup process on Local Machine

Requirements

Installing dependencies

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

Building

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
SAM_BUCKET=REPLACE_THIS_WITH_YOUR_S3_BUCKET_NAME

# Change if you want 
AWS_REGION=ap-northeast-1
STAGE=Dev
STACK_NAME=webrtc-signaling-server
ROOM_TABLE_NAME=Rooms
CONNECTION_TABLE_NAME=Connections

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')

License

Apache License 2.0

主要指标

概览
名称与所有者hakobera/serverless-webrtc-signaling-server
主编程语言Go
编程语言Makefile (语言数: 2)
平台
许可证Other
所有者活动
创建于2019-03-09 13:08:32
推送于2023-07-05 23:01:55
最后一次提交2020-07-17 21:02:27
发布数0
用户参与
星数76
关注者数3
派生数14
提交数26
已启用问题?
问题数5
打开的问题数2
拉请求数9
打开的拉请求数1
关闭的拉请求数0
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?