Installation
Add nuxt-socket-io
dependency to your project:
yarn add nuxt-socket-io
npm install nuxt-socket-io
Then, add nuxt-socket-io
to the modules
section of nuxt.config.js
:
nuxt.config.js
{
modules: [
'nuxt-socket-io'
],
io: {
// Options
}
}
In Nuxt3, Vuex is no longer shipped with it. You can consider using my nuxt3-vuex module to plug it in. If you wish to still use Vuex in Nuxt3 (not recommended), then you will also need at the minimum a Vuex state defined:
store/index.js
export const state = () => ({})
The module needs this so it can register its own Vuex module.
(NOTE: a new iox
option is meant to sort of be a drop-in replacement)