Skip to content
This repository was archived by the owner on Jun 18, 2025. It is now read-only.
This repository was archived by the owner on Jun 18, 2025. It is now read-only.

Q: Message not caught #94

Closed
Closed
@KingKnecht

Description

@KingKnecht

Hi,
I have following mutations:

 import $socket from '../../socket';

const state = {
  isConnected: false,
  message: null,
}

const mutations = {
  SOCKET_CONNECT: (state, status) => {
    state.isConnected = true;
    console.log("Connected");
  },
  SOCKET_USER_MESSAGE: (state, message) => {
    state.message = message;
    console.log("Usermessage from server:" + message);
  },
  Login: (state, message) => {
    state.message = message;
    console.log(message);
    $socket.emit('Login',message);
  },
}

if I send a message from server to my client like so:
socket.emit('USER_MESSAGE', 'Logged in successfully')

the message gets not caught. But I can see the message in the WS-Debugger window.
I'm I wrong here? My understanding is, that the message should be caught.

I'm able to send messages via Login() mutation to the server.

I don't get a SOCKET_CONNECT neither. Is that a standard message and should be caught or is it a user message as well?

Let me know if you need further information.

Thx,
Sven

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions