openhab-core
openhab-core copied to clipboard
Websocket response for invalid request does not work properly
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.