openhab-core icon indicating copy to clipboard operation
openhab-core copied to clipboard

Websocket response for invalid request does not work properly

Open spacemanspiff2007 opened this issue 9 months ago • 0 comments
trafficstars

Send this message over websockets (forget json in json for payload)

{
  "topic":"openhab/websocket/filter/type",
  "source":"HABApp",
  "eventId":"WebsocketTypeFilterMsg",
  "type":"WebSocketEvent",
  "payload":["ChannelDescriptionChangedEvent","ChannelTriggeredEvent","ConfigStatusInfoEvent","FirmwareStatusInfoEvent","GroupItemStateChangedEvent","GroupStateUpdatedEvent","ItemAddedEvent","ItemCommandEvent","ItemRemovedEvent","ItemStateChangedEvent","ItemStateEvent","ItemStatePredictedEvent","ItemStateUpdatedEvent","ItemUpdatedEvent","ThingAddedEvent","ThingRemovedEvent","ThingStatusInfoChangedEvent","ThingStatusInfoEvent","ThingUpdatedEvent","WebSocketEvent"]

Receive this:

{
  "type":"WebSocketEvent",
  "topic":"openhab/websocket/response/failed",
  "payload":"Deserialization error: java.lang.IllegalStateException: Expected a string but was BEGIN_ARRAY at line 1 column 130 path $.payload"}

According to Sending events the response should contain eventId which is missing in the response.


Would it be possible to return the invalid request in a request field as a string? That way the client side tracking of sent messages and mapping them to eventId would not be necessary. A new WebSocketRequestInvalid event type would be perfect for that.

spacemanspiff2007 avatar Jan 27 '25 08:01 spacemanspiff2007