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

TypeError: Cannot read property 'sendMessage' of undefined. Send to/with different topics/msg #175

Open
cazherosu opened this issue Dec 11, 2020 · 0 comments

Comments

@cazherosu
Copy link

Might be a dumb question, but how do you send messages with different topic and/or msg. I tried doing it in a switch-case, but that resulted in this error.

sendMessage = (messageMap) => { switch (messageMap) { case this.wsGet: this.clientRef.send(this.destinationPrefix + this.wsGet + "/" + this.roomId); break; case this.wsPost: this.clientRef.send(this.destinationPrefix + this.wsPost + "/" + this.roomId, {}, JSON.stringify({ taskName: this.state.taskName, taskDescription: this.state.taskDescription, finished: false })) break; default: console.log("sendMessage case was default...yikes"); break; } };

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

1 participant