easternbloc / node-stomp-client

A STOMP client for Node.js
Other
93 stars 47 forks source link

Connection Timeout? #5

Closed mightypenguin closed 11 years ago

mightypenguin commented 11 years ago

If the stomp server is down when stomp-client tries to connect, it won't timeout. It will just sit there waiting for a connection. If the server comes up it won't connect. There really should be a timeout or retry interval or something.

I apologize if I missed a timeout setting that is there, I wasn't able to find it.

You can test this by trying to connect to a server that doesn't exist.

Also there are like 4 stomp clients out there for Node. It would be nice if we had 1 really mature implementation.

easternbloc commented 11 years ago

Hi, I think you're right it doesn't have a timeout. Do you have a failing test for it per chance?

I'll try and get round to fixing this soon but I'm quite busy at the moment so it might take a week.

With regards to not being the most mature, I'm sorry but it's a fairly niche area so it's not that active.

easternbloc commented 11 years ago

Also, I'm more than happy to accept pull requests. There is no I in We.

victor73 commented 11 years ago

Does this implementation have a method for detecting if the connection to the Stomp server (ActiveMQ in my case) goes down? I'd like to have the ability to detect that and then reconnect myself if possible...

mightypenguin commented 11 years ago

I'd be open to providing a timeout patch. Currently I'm working on learning node since I'm new to it. Here's the documentation I think is relavent. http://nodejs.org/api/net.html#net_socket_settimeout_timeout_callback

Also should use keepalive I think. http://nodejs.org/api/net.html#net_socket_setkeepalive_enable_initialdelay

helxsz commented 11 years ago

I have the same timeout problem, the comments mightypenguin provided seems very useful, I am try it out, making a simple prototype

sam-github commented 11 years ago

Timeouts do not need to be set, TCP already errors when there are connection failures, but stomp wasn't notifying on error.