I am trying to implement a WebSocket server with ws (not socket.io) and based on these answers from StackOverflow, WebSocket messages must be in the format {event: "eventname', data: {data}} :
SubcribeMessage decorator doesn't trigger on event 'message'
Messages not reaching handler while using WebSocket and nestjs
I was wondering if there is a way to bypass this and/or if there is any official documentation regarding this.
Since the messages I am currently receiving from the server are in a fixed format, it would be nice to know if there is any more info on this. Thank you for reading.
I had a similar issue where I was getting WebSocket messages from Twilio when streaming call audio but Twilio doesn't use the
wspackage's format. My solution was to extend theWsAdapterand overwrite thebindMessageHandlerfunction to ensure thedatafield was present.