Skip to content

Get author name in the backend #193

@joweste

Description

@joweste

Hi, I need to show the message author when I receive the message in the front end app.
I am using node with socket io on backend.

When I send a message as abaixo, the component change always the author name to "me".
So, in the node backend, I have no author name that sent the message. I get only "me".

How could I get the original author of the message on backend?
Do I have to use an additional property in the json message?
Maybe I am wrong, but it is very odd I have to do it.
For sample if I do a broadcast on server to all connected users using socket io, I have only "me" as author.
All users will receive "me".

const msg={
          author: "John",
          type: "text",
          id: Math.round(Date.now() / 10),
          data: { text: text, meta: moment().format("h:mm a") },
        });
      }
    },
onMessageWasSent(message) {
      this.$socket.client.emit("user_message", msg);
 }

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