get public streams methods

This commit is contained in:
srgooglo 2022-05-12 14:59:14 +02:00
parent 2f717a179e
commit 5cb5f85b45

View File

@ -1,3 +1,5 @@
import lodash from "lodash"
export default class SessionsManager {
constructor() {
this.sessions = {}
@ -26,7 +28,18 @@ export default class SessionsManager {
this.publicStreams.push(payload)
}
unpublishStream = (id) => {
this.publicStreams = this.publicStreams.filter(stream => stream.id !== id)
unpublishStream = (stream_key) => {
this.publicStreams = this.publicStreams.filter(stream => stream.stream_key !== stream_key)
}
getPublicStreams = () => {
// return this.publicStreams but without stream_key property
return lodash.map(this.publicStreams, stream => {
return lodash.omit(stream, "stream_key")
})
}
getStreamsByUserId = (user_id) => {
return lodash.filter(this.publicStreams, stream => stream.user_id === user_id)
}
}