Path variables in Spring WebSockets @SendTo mapping

Even though @MessageMapping supports placeholders, they are not exposed / resolved in @SendTo destinations. Currently, there’s no way to define dynamic destinations with the @SendTo annotation (see issue SPR-12170). You could use the SimpMessagingTemplate for the time being (that’s how it works internally anyway). Here’s how you would do it: @MessageMapping(“/fleet/{fleetId}/driver/{driverId}”) public void simple(@DestinationVariable String … Read more

How to talk to UDP sockets with HTML5?

Yes, the answer is still ‘no’. Websockets are TCP based. Note that a WebSocket is not a plain TCP connection, there is HTTP negotiation and a framing protocol in place. So you also cannot create a plain TCP connection in Javascript. WebRTC is based on UDP, it may cover your use cases: http://www.html5rocks.com/en/tutorials/webrtc/datachannels/

How to view WS/WSS Websocket request content using Firebug or other?

Try Chrome’s developer tools, click ‘Network’ tab use the filters at the bottom to show only WebSocket connections), select the desired websocket connection, note that there are ‘Headers’, ‘Preview’, ‘Response’, etc. sub-tabs to the right, once data starts flowing a ‘WebSocket Frames’ subtab will appear. All data going in either direction is logged. Very informative.

Websocket vs REST when sending data to server

Here’s a summary of the tradeoffs I’m aware of. Reasons to use webSocket: You need/want server-push of data. You are sending lots of small pieces of data from client to server and doing it very regularly. Using webSocket has significantly less overhead per transmission. Reasons to use REST: You want to use server-side frameworks or … Read more

AngularJS and WebSockets beyond

Javascript supports WebSocket, so you don’t need an additional client side framework to use it. Please take a look at this $connection service declared in this WebSocket based AngularJS application. Basically you can listen for messages: $connection.listen(function (msg) { return msg.type == “CreatedTerminalEvent”; }, function (msg) { addTerminal(msg); $scope.$$phase || $scope.$apply(); }); Listen once (great … Read more