Backend service that provides WebRTC signaling for connecting clients together. This service offers:
- User registration and management
- A basic chat feature whereby a user can send a message to all other connected users
- Generic message handling for signaling and ICE negotiation to support a WebRTC session between two users
There are many ways to run this Quarkus app, but likely you want it available on the internet so it is widely accessible. You have options but our typical way of running this is in an OpenShift Developer Sandbox. We are working on a deployment of a versioned container release but aren't quite polished enough yet. For now you have a few steps to follow:
- Download or clone this git repo locally
- oc login to your account
- edit the
resources/application.properties
to set thequarkus.container-image.group
to your namespace - run
mvnw clean package
It should do everything needed to create all the Kubernetes reqsources and deploy the app
Below are 2 options for developing on this app:
- via a web IDE called Code Ready Workspaces
- locally on a machine with the JDK, Quarkus, wscat, and other dev tools installed.
- Login your CRW and navigate to the "Create Workspace" page
- Paste this repo's URL into the text box
- Click "Create & Open"
Note: this works because the repo has a devfile.yaml which has instructions for config and running our development environment.
Alternatively, and doing a bit more work, you can run your application locally in dev mode.
Exec the quarkus command that enables live coding using:
./mvnw quarkus:dev
Once the app is running, open http://localhost:8080 in your browser. Enter your desired username where indicated, and send a message to the socket using the Chat box at the bottom of the page.
You can also just connect directly to the socket from the terminal using a websocket client, like wscat
:
# Assuming you have npm installed, install the wscat package
npm install wscat
# Then open a connection to the server (ws://localhost:8080/chat/${username})like this:
wscat -c ws://localhost:8080/chat/andy
Once you're connected, send a message to chat using JSON, like this:
{"type":"message", "text":"This is a test message"}
The server expects most messages to take the form of a JSON object, giving particular regard to the following attributes:
- type: the message type. Supported values:
- message: this indicates a text message to convey to one person or to everyone
- userlist: this indcates that the list of users has updated in some way
- text: the text to send to the desired recipient(s), only applicable for type: message
- users: a list of usernames, only applicable for type: userlist
- target: the desired recipient of this message. If omitted, the message will be transmitted to all users currently connected to the socket.