This example uses "getMessage()" defined in the component
and consumes chatMessages that were sent directly to Vuex. If you can see text appear below, it worked!
When the event "chatMessage" is received, it's data will be stored in "chats/message" inside of the plugin's "ioState". To access the value,
use the provided "$ioState" and then get the desired value (this.$ioState().value.chats.message). Alternatively, You can also import { ioState } from 'nuxt-socket-io/lib/plugin.js'
| Send Event "getMessage" | ||
|---|---|---|
This example uses the namespace config specified entirely in
nuxt.config. The only thing needed in the component is data
definitions
In the config for channel '/index', we have
emitters
['getMessage2 + testMsg --> message2Rxd']
listeners
['chatMessage2', 'chatMessage3 --> message3Rxd']
| Send Event "getMessage2" with msg "testMsg" | Receive Intermediate Event(s) | Receive Final Response |
|---|---|---|
| (nuxt-socket-io created this method for us, by using the provided config) |