【发布时间】:2019-06-24 19:04:44
【问题描述】:
我开发了一个仪表板,它通过自定义事件获取实时通知。我想要实现的是能够在频道之间切换。我使用 Vue(x) 作为前端。
created() {
this.setTeam(this.$router.currentRoute.name);
this.clearFastlanes();
this.getSprintInfo('getSprintInfo');
window.Echo.channel(this.getTeam)
.listen('.jira.issue', this.jiraIssue)
.listen('.jira.fastlane', this.jiraFastlane);
},
这是我订阅自定义事件的主要组件。唯一的问题是,这个组件也被另一个团队使用。所以我想将我的频道更改为当前团队(离开当前频道并加入新团队的频道)。我真的无法在互联网上找到如何做到这一点。
这就是我的连接方式:
window.Echo = new Echo({
broadcaster: 'pusher',
key: '29564c255fe1dae3654b',
cluster: 'eu',
encrypted: true,
});
所以基本上我想问 laravel echo 我当前是否已连接,如果是,请离开频道并连接到新团队。
有人知道如何实现这一目标吗?
【问题讨论】:
标签: laravel vue.js pusher laravel-echo