Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
galene
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
galene
Commits
221ed445
Commit
221ed445
authored
Jan 24, 2022
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix joining in frontend documentation.
parent
6fbdf0ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
5 deletions
+27
-5
README.FRONTEND
README.FRONTEND
+27
-5
No files found.
README.FRONTEND
View file @
221ed445
...
...
@@ -54,23 +54,44 @@ callback indicates that a chat message has been posted to the group, and
`ondownstream` is called when the server pushes a stream to the client;
see the section below about streams.
You may now connect to the server
.
You may now connect to the server
:
```javascript
serverConnection.connect(`wss://${location.host}/ws`);
```
You typically join a group
and request media
in the `onconnected` callback:
You typically join a group in the `onconnected` callback:
```javascript
serverConnection.onconnected = function() {
this.join(group, 'join', username, password);
this.request({'':['audio','video']});
}
```
You should not attempt to push a stream to the server until it has granted
you the `present` permission through the `onjoined` callback.
After the server has replied to the join request, the `onjoined` callback
will trigger. There, you update your user interface and request incoming
streams:
```javascript
serverConnection.onjoined = function(kind, group, perms, status, message) {
switch(kind) {
case 'join':
this.request({'':['audio','video']});
// then update the UI, possibly taking perms.present into account
break;
case 'change':
// update the UI
break;
case 'redirect':
this.close();
document.location.href = message;
break;
case 'fail':
// display the friendly error message
break;
}
```
## Sending and receiving chat messages
...
...
@@ -85,6 +106,7 @@ You receive chat messages in the `onchat` callback. The server may
request that you clear your chat window, in that case the `onclearchat`
callback will trigger.
## Other messages
The `usermessage` method of the `ServerConnection` is similar to the
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment