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