refs #769 Switch local streaming method

This commit is contained in:
AkiraFukushima 2018-12-18 23:12:18 +09:00
parent c210bea4d9
commit 1e50e2dd6d
2 changed files with 9 additions and 5 deletions

View File

@ -469,20 +469,21 @@ ipcMain.on('stop-directmessages-streaming', (event, _) => {
let localStreaming = null
ipcMain.on('start-local-streaming', (event, ac) => {
accountManager.getAccount(ac._id)
ipcMain.on('start-local-streaming', (event, obj) => {
const { account, useWebsocket } = obj
accountManager.getAccount(account._id)
.catch((err) => {
log.error(err)
event.sender.send('error-start-local-streaming', err)
})
.then((account) => {
.then((acct) => {
// Stop old local streaming
if (localStreaming !== null) {
localStreaming.stop()
localStreaming = null
}
localStreaming = new StreamingManager(account)
localStreaming = new StreamingManager(acct, useWebsocket)
localStreaming.start(
'public/local',
'',

View File

@ -276,7 +276,10 @@ const TimelineSpace = {
},
startLocalStreaming ({ state }) {
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) => {
reject(err)
})