Skip to content
This repository was archived by the owner on Aug 2, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
Expand All @@ -32,3 +32,34 @@ jobs:

- name: Check docs
run: npm run docs

check-examples:
runs-on: ubuntu-latest

strategy:
matrix:
directory: [examples/room-manager]

defaults:
run:
working-directory: ${{ matrix.directory }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm

- name: Install SDK
working-directory: .
run: npm ci

- name: Check Room Manager example
working-directory: examples/room-manager
run: |
npm ci
npm run build:check
48 changes: 48 additions & 0 deletions .github/workflows/examples-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Examples CI

on:
push:
branches: [main]
paths: ['examples/**']

pull_request:
branches: [main]
paths: ['examples/**']

jobs:
ci:
runs-on: ubuntu-latest

strategy:
matrix:
directory: [examples/room-manager]

defaults:
run:
working-directory: ${{ matrix.directory }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm

- name: Install SDK
working-directory: .
run: npm ci

- name: Install dependencies
run: npm ci

- name: Check formatting
run: npm run format:check

- name: Check typing
run: echo `ls ../..` && npm run build:check

- name: Check linting
run: npm run lint:check
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
Expand Down
Empty file removed examples/.gitkeep
Empty file.
8 changes: 8 additions & 0 deletions examples/room-manager/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
PORT=8080
WEBHOOK_URL=http://host.docker.internal:8080/webhook
JELLYFISH_URL=http://localhost:5002
JELLYFISH_SERVER_TOKEN=development
# # Optional configuration:
# ENABLE_SIMULCAST=true
# PEERLESS_PURGE_TIMEOUT=60
# MAX_PEERS=32
2 changes: 2 additions & 0 deletions examples/room-manager/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
dist/
33 changes: 33 additions & 0 deletions examples/room-manager/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Room Manager example

A simple web server that uses the SDK to manage rooms and users on a Jellyfish server instance.

## Prerequisites

- Node.js
- Docker Compose

## Running

To start the Jellyfish server and the Room Manager, run the following commands:

```sh
EXTERNAL_IP=`ifconfig | grep 192.168 | cut -d ' ' -f 2` JELLYFISH_VERSION=edge docker compose up
cp .env.example .env
npm install
npm start
```

## Usage

Use

```sh
curl http://localhost:8080/rooms/exampleRoom/users/exampleUser
```

to obtain the websocket URL and authentication token of the `exampleUser` to connect to the `exampleRoom`.

Feel free use the example from
[react-client-sdk](https://github.com/jellyfish-dev/react-client-sdk/tree/main/examples/minimal-react) to test the
connection to the Jellyfish server with the provided token.
24 changes: 24 additions & 0 deletions examples/room-manager/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
services:
jellyfish:
image: 'ghcr.io/jellyfish-dev/jellyfish:${JELLYFISH_VERSION:-edge}'
container_name: jellyfish
restart: on-failure
healthcheck:
test: >
curl --fail -H "authorization: Bearer development" http://localhost:5002/health || exit 1
interval: 3s
retries: 2
timeout: 2s
environment:
JF_PORT: 5002
JF_HOST: 'localhost:5002'
JF_WEBRTC_TURN_IP: '${EXTERNAL_IP:-127.0.0.1}'
JF_WEBRTC_TURN_LISTEN_IP: '0.0.0.0'
JF_WEBRTC_TURN_PORT_RANGE: '50000-50050'
JF_WEBRTC_TURN_TCP_PORT: '49999'
JF_SERVER_API_TOKEN: 'development'
JF_CHECK_ORIGIN: 'false'
ports:
- '5002:5002'
- '49999:49999'
- '50000-50050:50000-50050/udp'
21 changes: 21 additions & 0 deletions examples/room-manager/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import globals from 'globals';

import path from 'path';
import { fileURLToPath } from 'url';
import { FlatCompat } from '@eslint/eslintrc';
import pluginJs from '@eslint/js';

import eslintConfigPrettier from 'eslint-config-prettier';

// mimic CommonJS variables -- not needed if using CommonJS
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({ baseDirectory: __dirname, recommendedConfig: pluginJs.configs.recommended });

export default [
{ languageOptions: { globals: globals.browser } },
...compat.extends('standard-with-typescript'),
{ files: ['**/*.ts'] },
{ rules: { '@typescript-eslint/strict-boolean-expressions': 'off' } },
eslintConfigPrettier,
];
Loading