Message not sent to channel

I am attempting to implement channels for my connection handler service. However, with the following code:

chatInput.addEventListener("keypress", event => {
  if(event.keyCode === 13){
    channel.push("new_msg", {body: chatInput.value})
    chatInput.value = ""

I get this console output:

Channel {state: "joined", topic: "room:lobby", params: {…}, socket: Socket, bindings: Array(4), …}
socket.js:72 fgfdg
socket.js:74 undefined

After hitting the enter key in the test chat window.

How is it that the channel is successfully created, the message is being correctly created in the value property and yet the value is not being appended to the channel body?

A channel has no property “body”.

You are just sending a message which has a field names body.

Nevermind, we fixed it now.

How? Explaining the issue might help others to not do the same again or at least recover faster.

1 Like