Skip to content

Multi-message frames over STOMP. [SPR-11328] #15952

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
spring-projects-issues opened this issue Jan 18, 2014 · 7 comments
Closed

Multi-message frames over STOMP. [SPR-11328] #15952

spring-projects-issues opened this issue Jan 18, 2014 · 7 comments
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Jan 18, 2014

Chris Mathias opened SPR-11328 and commented

Multi-message frames over STOMP. If I am connecting over websocket and in a single frame pass two messages (e.g. a page is setting up a list of subscribers on bootstrap of a SPA) the spring/stomp bit only recognizes the first message, the rest just disappear as if they weren't sent. With the control character it should be possible to recognize a list of messages. Will this be supported?

I am using the STOMP library for Dart and it may be an artifact of that library not sending two frames when it should.


Issue Links:

@spring-projects-issues
Copy link
Collaborator Author

Chris Mathias commented

Upon further review it seems that this is an artifact of the STOMP lib for Dart. I cannot emulate this problem with the JS stomp client from the example. I do not see anything in the stomp spec that expressly forbids multiple messages in a single frame, however it probably doesn't make sense for Spring to attempt to support this? I will work the problem on the Dart side.

Please close if that makes sense.

@spring-projects-issues
Copy link
Collaborator Author

Rossen Stoyanchev commented

Indeed the spec only says STOMP "assumes a reliable 2-way streaming network protocol (such as TCP) underneath". With TCP it's just a byte stream with null octets indicating message boundaries. The WebSocket protocol adds the notion of messages and it seems perfectly reasonable to be able to send multiple frames in one WebSocket message. The current STOMP spec however does not explicitly discuss WebSocket yet. There are plans for version 2.0 (see here). This is a question that should be considered so worth adding a comment there for consideration.

What does the Dart API look like? Does it accept multiple subscriptions in one API call? A reference to any discussions on that end would be useful to have here.

As for our side I think we may be able to add support for expecting and reading multiple STOMP frames from one WebSocket message on our side. That is without affecting any other clients that don't do that. And it may not be too hard to do with some relatively small changes. Have you determined what exactly happens in the code?

@spring-projects-issues
Copy link
Collaborator Author

Chris Mathias commented

It looks like StompDecoder.decode ~59 just doesn't account for the possibility. It looks for the exact right sequence and discards anything else after the EOL terminator.

On the dart side it doesn't so much "accept multiple subscriptions" as it seems to be an artifact of socket.sub1(); sockete.sub2() and they both go up in the same frame.

Specifically I am using the dart/stomp client: https://github.com/rikulo/stomp which wraps the dart ws client https://api.dartlang.org/docs/channels/stable/latest/dart_html/WebSocket.html

Let me know if I can help with any further useful info.

@spring-projects-issues
Copy link
Collaborator Author

Rossen Stoyanchev commented

Thanks for the reference. Not sure I follow the comment about socket.sub1() and socket.sub2() but I can see the StompConnector buffers frames as they get written, possibly flushing asyncronously more than one at a time. I also added a comment under the STOMP spec issue for WebSocket support. Thanks!

@spring-projects-issues
Copy link
Collaborator Author

Chris Mathias commented

Here is a reference to the underlying issue which I have developed a work around for in the client impl, in case you are interested. Ultimately it is the result of an async flush of the frame buffer.

rikulo/stomp#12

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Mar 7, 2014

Sébastien Deleuze commented

This issue is about supporting multiple STOMP frame into a single Websocket message. I added a link to #16152 which is about supporting the opposite: STOMP frame split into multiple Websocket messages.

Currently Dart STOMP behavior seems to be the following:

  • It sends a STOMP frame into multiple Websocket messages if it is bigger than 16 KBytes
  • It supports receiving a STOMP frame into a single Websocket message, a STOMP frame split into multiple Websocket messages and multiple STOMP frame into a single Websocket message.

@spring-projects-issues
Copy link
Collaborator Author

Rossen Stoyanchev commented

As of 4.0.3 we support multiple STOMP messages in a WebSocket message as well as one STOMP message split over multiple WebSocket messages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants