Skip to content
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

Excessive messages are returned when subscribe to /app endpoint multiple times. #12

Open
wjx opened this issue Mar 9, 2018 · 0 comments

Comments

@wjx
Copy link

wjx commented Mar 9, 2018

One subscribe to @SubscribeMapping should return one message, but when subscribe multiple times, excessive messages are returned:

Client:

stompClient.subscribe('/app/msg', function(msg) {
            console.log("subscribe1 callback");
        });
        stompClient.subscribe('/app/msg', function(msg) {
            console.log("subscribe2 callback");
        });

Server:

@SubscribeMapping("/msg")
	public Greeting msg() {
		return new Greeting("Hello, World!");
	}

Expected:
Two messages with content Hello, World! returned.

But excessive messages are returned.

Logs:

Web Socket Opened...
18:10:24.104 stomp.min.js:8 >>> CONNECT
accept-version:1.1,1.0
heart-beat:10000,10000


18:10:24.173 stomp.min.js:8 <<< CONNECTED
version:1.1
heart-beat:0,0


18:10:24.174 stomp.min.js:8 connected to server undefined
18:10:24.181 app.js?_=dsd:24 Connected: CONNECTED
heart-beat:0,0
version:1.1


18:10:24.182 stomp.min.js:8 >>> SUBSCRIBE
id:sub-0
destination:/app/msg


18:10:24.182 stomp.min.js:8 >>> SUBSCRIBE
id:sub-1
destination:/app/msg


18:10:25.271 stomp.min.js:8 <<< MESSAGE
destination:/app/msg
message-id:559f29a724bd48b794f270b71a18aa71-1
content-type:application/json;charset=UTF-8
subscription:sub-0
content-length:27

{"content":"Hello, World!"}
18:10:25.272 app.js?_=dsd:34 subscribe1 callback
18:10:25.273 stomp.min.js:8 <<< MESSAGE
destination:/app/msg
message-id:559f29a724bd48b794f270b71a18aa71-1
content-type:application/json;charset=UTF-8
subscription:sub-1
content-length:27

{"content":"Hello, World!"}
18:10:25.273 app.js?_=dsd:37 subscribe2 callback
18:10:25.277 stomp.min.js:8 <<< MESSAGE
destination:/app/msg
message-id:559f29a724bd48b794f270b71a18aa71-0
content-type:application/json;charset=UTF-8
subscription:sub-0
content-length:27

{"content":"Hello, World!"}
18:10:25.277 app.js?_=dsd:34 subscribe1 callback
18:10:25.278 stomp.min.js:8 <<< MESSAGE
destination:/app/msg
message-id:559f29a724bd48b794f270b71a18aa71-0
content-type:application/json;charset=UTF-8
subscription:sub-1
content-length:27

{"content":"Hello, World!"}
18:10:25.279 app.js?_=dsd:37 subscribe2 callback

Thanks!

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

No branches or pull requests

1 participant