Browse Source

Added server side ApiVersion returned with self to distinguish client and server API version support.

pull/192/head
Simon Eisenmann 11 years ago
parent
commit
69db76290d
  1. 36
      doc/CHANNELING-API.txt
  2. 19
      src/app/spreed-webrtc-server/channelling.go
  3. 20
      src/app/spreed-webrtc-server/channelling_api.go
  4. 4
      static/js/app.js

36
doc/CHANNELING-API.txt

@ -117,6 +117,7 @@ Special purpose documents for channling
"Suserid": "", "Suserid": "",
"Token": "some-very-long-string", "Token": "some-very-long-string",
"Version": "server-version-number", "Version": "server-version-number",
"ApiVersion": 1.4,
"Turn": { "Turn": {
"username": "turn-username", "username": "turn-username",
"password": "turn-password", "password": "turn-password",
@ -136,21 +137,26 @@ Special purpose documents for channling
Keys: Keys:
Type : Self (string) Type : Self (string)
Id : Public Session id for this connection (string). Id : Public Session id for this connection (string).
Sid : Secure (non public) id for this session (string). Sid : Secure (non public) id for this session (string).
Userid : User id if this session belongs to an authenticated user. Else empty. Userid : User id if this session belongs to an authenticated user.
Suserid : Secure (non public) user id if session has an user id. Else empty. Else empty.
Token : Security token (string), to restablish connection with the same Suserid : Secure (non public) user id if session has an user id.
session. Pass the value as URL query parameter t, to the websocket URL. Else empty.
Version : Server version number. Use this to detect server upgrades. Token : Security token (string), to restablish connection with the
Turn : Mapping (interface{}) to contain TURN server details, like same session. Pass the value as URL query parameter t, to
urls, password and username. See the websocket URL.
http://tools.ietf.org/html/draft-uberti-behave-turn-rest-00 Version : Server version number. Use this to detect server upgrades.
and TURN REST API section in ApiVersion : Server channeling API base version. Use this version to select
https://code.google.com/p/rfc5766-turn-server/wiki/turnserver client side compatibility with the connected server.
for details. Turn : Mapping (interface{}) to contain TURN server details, like
Stun : Array with STUN server URLs. urls, password and username. See
http://tools.ietf.org/html/draft-uberti-behave-turn-rest-00
and TURN REST API section in
https://code.google.com/p/rfc5766-turn-server/wiki/turnserver
for details.
Stun : Array with STUN server URLs.
You can also send an empty Self document to the server to make the server You can also send an empty Self document to the server to make the server
transmit a fresh Self document (eg. to refresh when ttl was reached). Please transmit a fresh Self document (eg. to refresh when ttl was reached). Please

19
src/app/spreed-webrtc-server/channelling.go

@ -79,15 +79,16 @@ type DataAnswer struct {
} }
type DataSelf struct { type DataSelf struct {
Type string Type string
Id string Id string
Sid string Sid string
Userid string Userid string
Suserid string Suserid string
Token string Token string
Version string Version string // Server version.
Turn *DataTurn ApiVersion float64 // Server channelling API version.
Stun []string Turn *DataTurn
Stun []string
} }
type DataTurn struct { type DataTurn struct {

20
src/app/spreed-webrtc-server/channelling_api.go

@ -28,6 +28,7 @@ import (
const ( const (
maxConferenceSize = 100 maxConferenceSize = 100
apiVersion = 1.4 // Keep this in sync with CHANNELING-API docs.Hand
) )
type ChannellingAPI interface { type ChannellingAPI interface {
@ -171,15 +172,16 @@ func (api *channellingAPI) HandleSelf(session *Session) (*DataSelf, error) {
log.Println("Created new session token", len(token), token) log.Println("Created new session token", len(token), token)
self := &DataSelf{ self := &DataSelf{
Type: "Self", Type: "Self",
Id: session.Id, Id: session.Id,
Sid: session.Sid, Sid: session.Sid,
Userid: session.Userid(), Userid: session.Userid(),
Suserid: api.EncodeSessionUserID(session), Suserid: api.EncodeSessionUserID(session),
Token: token, Token: token,
Version: api.Version, Version: api.Version,
Turn: api.CreateTurnData(session), ApiVersion: apiVersion,
Stun: api.StunURIs, Turn: api.CreateTurnData(session),
Stun: api.StunURIs,
} }
return self, nil return self, nil

4
static/js/app.js

@ -208,9 +208,9 @@ define([
}; };
// Our API version as float. This value is incremented on // Our client side API version as float. This value is incremented on
// breaking changes to plugins can check on it. // breaking changes to plugins can check on it.
var apiversion = 1.4; var apiversion = 1.1;
var initialize = function(app, launcher) { var initialize = function(app, launcher) {

Loading…
Cancel
Save