adonuxt-template icon indicating copy to clipboard operation
adonuxt-template copied to clipboard

Error document is not defined when connect channel by adonis-websocket-client

Open revan2006 opened this issue 8 years ago • 1 comments

Hello, not sure if it real issue, but you can't connect to channel it error document is not defined ('node_modules\adonis-websocket-client\dist\ws.js'). in here my code:

import Vue from 'vue' import ws from 'adonis-websocket-client' const wsVuePlugin = function (Vue, url, options) { Vue.prototype.$io = ws(url, options) } Vue.use(wsVuePlugin, 'http://localhost:3000', {})

export default { created: function () { this.$io.channel('chat').connect(console.log) } }

This question is available on Nuxt.js community (#c54)

revan2006 avatar Aug 28 '17 17:08 revan2006

Make sure you only create the websocket on client, not on server.

lowi avatar May 18 '19 14:05 lowi