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
63e2b5a4
Commit
63e2b5a4
authored
Jan 11, 2021
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement 'noecho' field in client messages.
parent
9f67a03f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
3 deletions
+15
-3
README.PROTOCOL
README.PROTOCOL
+4
-1
rtpconn/webclient.go
rtpconn/webclient.go
+7
-1
static/protocol.js
static/protocol.js
+4
-1
No files found.
README.PROTOCOL
View file @
63e2b5a4
...
@@ -233,6 +233,7 @@ A chat message may be sent using a `chat` message.
...
@@ -233,6 +233,7 @@ A chat message may be sent using a `chat` message.
username: username,
username: username,
dest: dest-id,
dest: dest-id,
privileged: boolean,
privileged: boolean,
noecho: false,
value: message
value: message
}
}
```
```
...
@@ -242,7 +243,9 @@ the clients in the group. If `source` is empty, then the message was
...
@@ -242,7 +243,9 @@ the clients in the group. If `source` is empty, then the message was
originated by the server. The message is forwarded by the server without
originated by the server. The message is forwarded by the server without
interpretation, the server only validates that the `source` and `username`
interpretation, the server only validates that the `source` and `username`
fields are authentic. The field `privileged` is set to true by the server
fields are authentic. The field `privileged` is set to true by the server
if the message was originated by a client with the `op` permission.
if the message was originated by a client with the `op` permission. The
field `noecho` is set by the client if it doesn't wish to receive a copy
of its own message.
A user message is similar to a chat message, but is not conserved in the
A user message is similar to a chat message, but is not conserved in the
chat history, and is not expected to contain user-visible content.
chat history, and is not expected to contain user-visible content.
...
...
rtpconn/webclient.go
View file @
63e2b5a4
...
@@ -173,6 +173,7 @@ type clientMessage struct {
...
@@ -173,6 +173,7 @@ type clientMessage struct {
Permissions
*
group
.
ClientPermissions
`json:"permissions,omitempty"`
Permissions
*
group
.
ClientPermissions
`json:"permissions,omitempty"`
Group
string
`json:"group,omitempty"`
Group
string
`json:"group,omitempty"`
Value
interface
{}
`json:"value,omitempty"`
Value
interface
{}
`json:"value,omitempty"`
NoEcho
bool
`json:"noecho,omitempty"`
Time
int64
`json:"time,omitempty"`
Time
int64
`json:"time,omitempty"`
SDP
string
`json:"sdp,omitempty"`
SDP
string
`json:"sdp,omitempty"`
Candidate
*
webrtc
.
ICECandidateInit
`json:"candidate,omitempty"`
Candidate
*
webrtc
.
ICECandidateInit
`json:"candidate,omitempty"`
...
@@ -1209,10 +1210,15 @@ func handleClientMessage(c *webClient, m clientMessage) error {
...
@@ -1209,10 +1210,15 @@ func handleClientMessage(c *webClient, m clientMessage) error {
Privileged
:
c
.
permissions
.
Op
,
Privileged
:
c
.
permissions
.
Op
,
Time
:
tm
,
Time
:
tm
,
Kind
:
m
.
Kind
,
Kind
:
m
.
Kind
,
NoEcho
:
m
.
NoEcho
,
Value
:
m
.
Value
,
Value
:
m
.
Value
,
}
}
if
m
.
Dest
==
""
{
if
m
.
Dest
==
""
{
err
:=
broadcast
(
g
.
GetClients
(
nil
),
mm
)
var
except
group
.
Client
if
m
.
NoEcho
{
except
=
c
}
err
:=
broadcast
(
g
.
GetClients
(
except
),
mm
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Printf
(
"broadcast(chat): %v"
,
err
)
log
.
Printf
(
"broadcast(chat): %v"
,
err
)
}
}
...
...
static/protocol.js
View file @
63e2b5a4
...
@@ -176,6 +176,7 @@ function ServerConnection() {
...
@@ -176,6 +176,7 @@ function ServerConnection() {
* @property {Object<string,boolean>} [permissions]
* @property {Object<string,boolean>} [permissions]
* @property {string} [group]
* @property {string} [group]
* @property {unknown} [value]
* @property {unknown} [value]
* @property {boolean} [noecho]
* @property {string} [sdp]
* @property {string} [sdp]
* @property {RTCIceCandidate} [candidate]
* @property {RTCIceCandidate} [candidate]
* @property {Object<string,string>} [labels]
* @property {Object<string,string>} [labels]
...
@@ -477,8 +478,9 @@ ServerConnection.prototype.userAction = function(kind, dest, value) {
...
@@ -477,8 +478,9 @@ ServerConnection.prototype.userAction = function(kind, dest, value) {
* @param {string} kind - The kind of application-specific message.
* @param {string} kind - The kind of application-specific message.
* @param {string} dest - The id to send the message to, empty for broadcast.
* @param {string} dest - The id to send the message to, empty for broadcast.
* @param {string} [value] - An optional parameter.
* @param {string} [value] - An optional parameter.
* @param {boolean} [noecho] - If set, don't echo back the message to the sender.
*/
*/
ServerConnection
.
prototype
.
userMessage
=
function
(
kind
,
dest
,
value
)
{
ServerConnection
.
prototype
.
userMessage
=
function
(
kind
,
dest
,
value
,
noecho
)
{
this
.
send
({
this
.
send
({
type
:
'
usermessage
'
,
type
:
'
usermessage
'
,
source
:
this
.
id
,
source
:
this
.
id
,
...
@@ -486,6 +488,7 @@ ServerConnection.prototype.userMessage = function(kind, dest, value) {
...
@@ -486,6 +488,7 @@ ServerConnection.prototype.userMessage = function(kind, dest, value) {
username
:
this
.
username
,
username
:
this
.
username
,
kind
:
kind
,
kind
:
kind
,
value
:
value
,
value
:
value
,
noecho
:
noecho
,
});
});
};
};
...
...
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