Skip to content

filter callback function doesn't show the JSON parsed message #205

Open
@lucafaggianelli

Description

@lucafaggianelli

hi, I'm using the filter callback to filter messages, though that callback has a MessageEvent as argument, so I need to JSON.parse the message before applying the filter:

const filter = (msg: MessageEvent) => {
    const { type } = JSON.parse(msg.data)

    return type === topic
  }

then later I use the lastJsonMessage hook property so I guess I parse the message twice... is there another solution to avoid a double parse?

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