mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 02:54:15 +00:00
added publishStream
& unpublishStream
methods
This commit is contained in:
parent
bb2cd23c4b
commit
ff34d2900b
@ -1,6 +1,7 @@
|
||||
export default class SessionsManager {
|
||||
constructor() {
|
||||
this.sessions = {}
|
||||
this.publicStreams = []
|
||||
}
|
||||
|
||||
newSession = (id, session) => {
|
||||
@ -16,4 +17,16 @@ export default class SessionsManager {
|
||||
|
||||
delete this.sessions[id]
|
||||
}
|
||||
|
||||
publishStream = (payload) => {
|
||||
if (typeof payload !== "object") {
|
||||
throw new Error("Payload must be an object")
|
||||
}
|
||||
|
||||
this.publicStreams.push(payload)
|
||||
}
|
||||
|
||||
unpublishStream = (id) => {
|
||||
this.publicStreams = this.publicStreams.filter(stream => stream.id !== id)
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user