refs #769 Switch local streaming method
This commit is contained in:
parent
c210bea4d9
commit
1e50e2dd6d
|
@ -469,20 +469,21 @@ ipcMain.on('stop-directmessages-streaming', (event, _) => {
|
||||||
|
|
||||||
let localStreaming = null
|
let localStreaming = null
|
||||||
|
|
||||||
ipcMain.on('start-local-streaming', (event, ac) => {
|
ipcMain.on('start-local-streaming', (event, obj) => {
|
||||||
accountManager.getAccount(ac._id)
|
const { account, useWebsocket } = obj
|
||||||
|
accountManager.getAccount(account._id)
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
log.error(err)
|
log.error(err)
|
||||||
event.sender.send('error-start-local-streaming', err)
|
event.sender.send('error-start-local-streaming', err)
|
||||||
})
|
})
|
||||||
.then((account) => {
|
.then((acct) => {
|
||||||
// Stop old local streaming
|
// Stop old local streaming
|
||||||
if (localStreaming !== null) {
|
if (localStreaming !== null) {
|
||||||
localStreaming.stop()
|
localStreaming.stop()
|
||||||
localStreaming = null
|
localStreaming = null
|
||||||
}
|
}
|
||||||
|
|
||||||
localStreaming = new StreamingManager(account)
|
localStreaming = new StreamingManager(acct, useWebsocket)
|
||||||
localStreaming.start(
|
localStreaming.start(
|
||||||
'public/local',
|
'public/local',
|
||||||
'',
|
'',
|
||||||
|
|
|
@ -276,7 +276,10 @@ const TimelineSpace = {
|
||||||
},
|
},
|
||||||
startLocalStreaming ({ state }) {
|
startLocalStreaming ({ state }) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
ipcRenderer.send('start-local-streaming', state.account)
|
ipcRenderer.send('start-local-streaming', {
|
||||||
|
account: state.account,
|
||||||
|
useWebsocket: state.useWebsocket
|
||||||
|
})
|
||||||
ipcRenderer.once('error-start-local-streaming', (event, err) => {
|
ipcRenderer.once('error-start-local-streaming', (event, err) => {
|
||||||
reject(err)
|
reject(err)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue