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

Heartbeat in Messaging SimpleBroker [SPR-10954] #15582

Closed
spring-issuemaster opened this issue Oct 2, 2013 · 9 comments

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented Oct 2, 2013

nebhale opened SPR-10954 and commented

Currently, when using a SimpleBroker heart-beating is not supported. This is problematic in the Cloud Foundry (http://run.pivotal.io) environment as it seems to close WebSocket connections after 60 seconds. The work around for this is to deploy and bind an MQ server (like RabbitMQ) to the application and use the StompBrokerRelay. This is overkill for my use-case (a small scale build-monitor application) and it'd be nice to have to do this/pay for an MQ.


Referenced from: commits de9675b, 4b07bc3

3 votes, 5 watchers

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Oct 2, 2013

Rossen Stoyanchev commented

The SockJS layer heartbeats are for this reason exactly. By default the server sends a heartbeat every 25 seconds, so try simply adding .withSockJS().

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Oct 2, 2013

nebhale commented

I've not used SockJS because A) I'm targeting web browsers that all support WebSockets natively and B) I've been informed that there's some sort of problem with the Heart-beating in Cloud Foundry. Is the latter still true?

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Oct 2, 2013

Rossen Stoyanchev commented

If it's easy enough, please give it a quick try. When WebSocket is available, SockJS uses it as the preferred transport, so I'd expect it to work and that'd be useful to know.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Oct 18, 2013

Rossen Stoyanchev commented

Resolving as Won't Fix for the time being to keep the simple broker "simple" but we can revisit if the need arises.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Mar 18, 2014

le roy arnaud commented

But it coulbe a good idea simplebroker accept incoming heartbeat.
for exemple with the stompjs library, we can set a hearbeat delay to send to the server, but with the simple broker the response to the connect desactivate this functionnality.
ex :
REQUEST
login:test
passcode:test
accept-version:1.1,1.0
heart-beat:10000,10000
RESPONSE
stomp.js:130
<<< CONNECTED
user-name:arnaud
heart-beat:0,0
version:1.1
as you can see heartbeat is set to 0,0 so the stompjs library don't send heartbeat

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Mar 18, 2014

Rossen Stoyanchev commented

The heartbeat is deactivated because it's not supported in the simple broker. If we returned 10000,10000 for example and then did not send a heartbeat every 10 seconds or so, the client would assume the server is gone. So it's not just about the initial response, it's either supported fully or not.

Can you provide a little more context around what you intend? As mentioned above the simple broker isn't really meant to be an option for use in production.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Mar 18, 2014

le roy arnaud commented

i say that because i work on an unstable network (mobile network) and often i lose the connection but cause of Keep-alive connection the client (chrome brwoser for exemple) don't see it.
so if the client send heartbeat to the server it could be detect quickly that the connection is lost

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Mar 18, 2014

Rossen Stoyanchev commented

I see. Remember you also have the the SockJS layer sending heartbeats from server to client, every 25 seconds by default, to keep proxies from deciding the connection is hung. If you configure that to something less wouldn't that give you the same result?

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Mar 18, 2014

le roy arnaud commented

i use the sockjs layer but i think in my case i need an heartbeat from client to server. so i detect quickly in the client when the network is down and after i try to reconnect to the server.
unfortunately sockjs don't seem to provide heartbeat in this way client => server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.