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 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',
'', '',

View File

@ -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)
}) })