Reputation: 21
I have been able to get websockets working with my application using sock.js stompjs and spring 4. However I'm having jackson mapping issues when I try to send a json object and use @validated. The jackson error is: Could not read JSON: can not deserialize instance of com.... out of START_ARRAY token Here is the server side code:
@MessageMapping("/notify/{id}")
@SendTo("/subscription/{id}")
@ResponseBody
public SimpleDemoObject add(@Payload @Validated ReqObject req, @DestinationVariable("id") Long id, Errors errors)
And the client side:
socket.stomp.send( _contextPath + "/notify/" + id, {"content-type": "application/json"}, data);
I was previously trying to use @RequestBody but I believe @Payload is the correct way here? I can get it to work if I remove @Payload and @Validated but I would like to use spring validation on my request object. Any tips on what I'm doing wrong?
Upvotes: 2
Views: 496