Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Q: Message not caught #94

Closed
KingKnecht opened this issue Jun 19, 2018 · 2 comments
Closed

Q: Message not caught #94

KingKnecht opened this issue Jun 19, 2018 · 2 comments

Comments

@KingKnecht
Copy link

KingKnecht commented Jun 19, 2018

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

@KingKnecht
Copy link
Author

I messed up something with my imports and was able to fix it with help of #91

@probil
Copy link
Owner

probil commented Jun 19, 2018

Awesome! In any case, thanks for your issue. Let me know if you have any other issues :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants