Browse Source

Added priority to sessions.

pull/48/head
Simon Eisenmann 11 years ago
parent
commit
fe67adf965
  1. 12
      doc/CHANNELING-API.txt
  2. 1
      src/app/spreed-webrtc-server/channeling.go
  3. 13
      src/app/spreed-webrtc-server/session.go

12
doc/CHANNELING-API.txt

@ -282,7 +282,8 @@ Additional types for session listing and notifications @@ -282,7 +282,8 @@ Additional types for session listing and notifications
"Id": "7",
"Userid": "u7",
"Ua": "Chrome 28",
"Status": null
"Status": null,
"Prio": 100
}
Note: The Userid field is only present if that session belongs to a known user.
@ -324,21 +325,24 @@ Additional types for session listing and notifications @@ -324,21 +325,24 @@ Additional types for session listing and notifications
"Type": "Online",
"Id": "1",
"Ua": "Firefox 27",
"Status": {...}
"Status": {...},
"Prio": 100
},
{
"Type": "Online",
"Id": "3",
"Userid": "u3",
"Ua": "Chrome 28",
"Status": {...}
"Status": {...},
"Prio": 100
},
{
"Type": "Online",
"Id": "4",
"Userid": "u4",
"Ua": "Chrome 28",
"Status": {...}
"Status": {...},
"Prio": 100
}
]
}

1
src/app/spreed-webrtc-server/channeling.go

@ -72,6 +72,7 @@ type DataSession struct { @@ -72,6 +72,7 @@ type DataSession struct {
Token string `json:",omitempty"`
Version string `json:",omitempty"`
Rev uint64 `json:",omitempty"`
Prio int `json:",omitempty"`
Status interface{}
}

13
src/app/spreed-webrtc-server/session.go

@ -37,6 +37,7 @@ type Session struct { @@ -37,6 +37,7 @@ type Session struct {
UpdateRev uint64
Status interface{}
Nonce string
Prio int
mutex sync.RWMutex
userid string
}
@ -44,8 +45,9 @@ type Session struct { @@ -44,8 +45,9 @@ type Session struct {
func NewSession(id, sid string) *Session {
return &Session{
Id: id,
Sid: sid,
Id: id,
Sid: sid,
Prio: 100,
}
}
@ -59,12 +61,12 @@ func (s *Session) Update(update *SessionUpdate) uint64 { @@ -59,12 +61,12 @@ func (s *Session) Update(update *SessionUpdate) uint64 {
//fmt.Println("type update", key)
switch key {
//case "Roomid":
// s.Roomid = update.Roomid
case "Ua":
s.Ua = update.Ua
case "Status":
s.Status = update.Status
case "Prio":
s.Prio = update.Prio
}
}
@ -174,6 +176,7 @@ func (s *Session) DataSessionJoined() *DataSession { @@ -174,6 +176,7 @@ func (s *Session) DataSessionJoined() *DataSession {
Id: s.Id,
Userid: s.userid,
Ua: s.Ua,
Prio: s.Prio,
}
}
@ -189,6 +192,7 @@ func (s *Session) DataSessionStatus() *DataSession { @@ -189,6 +192,7 @@ func (s *Session) DataSessionStatus() *DataSession {
Userid: s.userid,
Status: s.Status,
Rev: s.UpdateRev,
Prio: s.Prio,
}
}
@ -198,6 +202,7 @@ type SessionUpdate struct { @@ -198,6 +202,7 @@ type SessionUpdate struct {
Types []string
Roomid string
Ua string
Prio int
Status interface{}
}

Loading…
Cancel
Save