We use SignalR for real-time communication between Frontend and Backend. SignalR is an open-source framework that abstracts multiple ways of implementing real-time communication via Web Sockets or Long-Pulling. It also supports authentication and connection grouping.
To lean more about SignalR, we recommend the following resources:
The backend offers SignalR hubs to connect with. A client can connect to these Hubs (mostly via WebSockets) by calling their URLs.
SignalR offers client libraries for a wide set of frameworks and programming languages. We highly recommend to use on of these libraries.
With the SignalR client library for JavaScript for example, a connection looks like this:
// Prepare SignalR connection to the Streaming Backend
const connection = new HubConnectionBuilder()
.withUrl('https://example.com/something?property=test', { accessTokenFactory: async () => return 'YOUR_ACCESS_TOKEN' })
.build();
// Subscribe to events from stream
this.streamConnection.on('SomeEvent', (object) => {
// ...
});
// Start the connection
await connection.start();
We currently offer connection endpoints in form of SignalR Hubs for the following use-cases:
Each event contains a set of endpoints for these use-cases that you can use to connect to the SignalR Hubs for these specific event. When receiving an event form the REST API, it contains these connection information.
{
"id": "1",
"name": "Lorem Ispum",
// ...
"endpoints": {
// ...
"signalR": {
"recorder": "https://something.com/recorder/...",
"corrector": "https://something.com/corrector/...",
"listener": "https://something.com/listener/..."
}
}
}
The backend offers the following hubs to connect with:
/recorder?eventId=xxx
A client can connect to the Recorder Hub, to send transcribed sentences to the backend. Depending on the event configuration, these sentences will either be sent to the Listeners or the Moderators of an event.
A client can subscribe to the following events:
Event Id | Description |
---|---|
ReceivedSentence |
Gets called by the backend, when a sentence has been processed and gets sent back to the
recorder. A
Sentence
object will be passed.
|
ReceivedMessage |
Gets called, when something happens in the backend, that the recorder should get notified
about. The type of that message is defined in the
BackendMessage
enum, so that the frontend clients can react on it. A
BackendMessage
object will be passed.
|
ChangedLanguage |
Gets called, when the recording language should get changed. A
Language
object will be passed.
|
StartedRecording |
Notifies the client that the Hub is ready to receive sentences. The
StartRecording
method has to be called before.
|
A client can call the following methods:
Method Id | Description |
---|---|
StartRecording |
Starts a recording session on the server. This call is mandatory to send sentences. If this has not been called, all sentences will be rejected. |
StopRecording |
Stops the recording on the server. |
SendSentence |
Sends a recorded
Sentence
object to the server. A
Sentence
object needs to be passed.
|
/corrector?eventId=xxx
A client can connect to the Correcor Hub, to correct transcribed sentences and send them back to the backend. These corrected sentences will be sent to the Listeners of an event.
A client can subscribe to the following events:
Event Id | Description |
---|---|
ReceivedSentence |
Gets called by the backend, when a sentence has been processed and gets sent to the
corrector for correction. A
Sentence
object will be passed.
|
A client can call the following methods:
Method Id | Description |
---|---|
ApproveSentence |
Sends a corrected or uncorrected sentence back to the server to send it further to all
listeners. Please pass a
Sentence
object.
|
ChangeLanguage |
Changes the recording language remotely to another language. A
Language
object needs to be passed.
|
SendSentence |
Sends a recorded
Sentence
object to the server. A
Sentence
object needs to be passed.
|
/corrector?eventId=xxx
A client can connect to the Listener Hub, to receive transcribed sentences and display them.
A client can subscribe to the following events:
Event Id | Description |
---|---|
ReceivedSentence |
Gets called by the backend, when a sentence has been processed and gets sent to the listener
for display. A
Sentence
object will be passed.
|
ReceivedMessage |
Gets called, when something happens in the backend, that the recorder should get notified
about. The type of that message is defined in the
BackendMessage
enum, so that the frontend clients can react on it. A
BackendMessage
object will be passed.
|
A client can call the following methods:
Method Id | Description |
---|---|
ValidateEventPassword |
Unlocks a password protected event by sending the password to the server. A
string
object needs to be passed.
|