Skip to content
This repository has been archived by the owner on May 5, 2021. It is now read-only.

Error frame confusion #24

Open
rocketraman opened this issue Sep 14, 2016 · 4 comments
Open

Error frame confusion #24

rocketraman opened this issue Sep 14, 2016 · 4 comments

Comments

@rocketraman
Copy link

It looks like when an error frame is received, it is always handled by the connect error callback.

For example:

  1. CONNECT -- server returns success
  2. SUBSCRIBE -- server returns error response e.g. permission denied
  3. client calls CONNECT error callback

This is pretty confusing and hard to program against -- one would expect some sort of error callback related to the SUBSCRIBE for step 2 and 3.

@JSteunou
Copy link
Owner

I do agree. I forked previous stomp lib with all pending PR + re-write it in es6 with no major evolution to not break the API a lot. Now I would like to launch a future major release with a lot of enhancement + some test sbut I really need some free time to do it or some PRs to help me.

@Mamoru1234
Copy link
Contributor

Mamoru1234 commented Mar 2, 2017

Actually, I think it is expected behavior. Because STOMP doesn't declare how to handle ERROR frames, and that's why src/client.js:136 allow a user to decide how to handle it properly. I agree that errorCallback is a bit confusing name, but I can't imagine better.

Also, remember that adding special heads require additional server-side enhancement(which most of the time is too hard).

@rocketraman
Copy link
Author

rocketraman commented Mar 2, 2017

I agree that errorCallback is a bit confusing name, but I can't imagine better.

What's confusing is not the name of the callback, but where it is passed in. It is passed in to the connect method, but is also called as a result of other operations like subscribe.

If there is no way for the client to distinguish between a connect and a subscribe error (which seems to be the case), then the error callback should be configured at the client level i.e. before calling connect.

@Mamoru1234
Copy link
Contributor

@rocketraman There is no way to distinguish ERROR frames. I think it's good idea to have 1 global errorHandler per Client instance.

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

No branches or pull requests

3 participants