action cable nuxtjs code example
Example 1: action cable nuxtjs
import store from './store';
import Vue from 'vue';
import ActionCableVue from 'actioncable-vue';
Vue.use(ActionCableVue, {
debug: true,
debugLevel: 'all',
connectionUrl: process.env.WEBSOCKET_HOST,
connectImmediately: true,
store
});
Example 2: action cable nuxtjs
import Vue from 'vue';
import ActionCableVue from 'actioncable-vue';
if (process.client) {
Vue.use(ActionCableVue, {
debug: true,
debugLevel: 'all',
connectionUrl: process.env.WEBSOCKET_HOST,
connectImmediately: true
});
}
Example 3: action cable nuxtjs
plugins: [{ src: '@/plugins/actioncable-vue', ssr: false }];