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

onStateChange returning a different resource UUID when connection is closed #678

Closed
dubrie opened this issue Oct 10, 2012 · 2 comments
Closed
Labels

Comments

@dubrie
Copy link

dubrie commented Oct 10, 2012

Version 1.0.1

I can create a new connection, send multiple requests in from a client and a persistent resource uuid is always returned:

Creating a new connection:

AtmosphereResource r = event.getResource()
println "ONREQUEST resource uuid: ${r.uuid()}"

// ONREQUEST resource uuid: a4a1309c-d801-43f7-a441-26a01cbb7532

Sending messages from client:

AtmosphereResource r = event.getResource()
println "ONSTATECHANGE resource uuid: ${r.uuid()}"

// ONSTATECHANGE resource uuid: a4a1309c-d801-43f7-a441-26a01cbb7532

However, when I close the connection from the client, I am getting a new resource uuid in the onStateChange method.

AtmosphereResource r = event.getResource()
println "ONSTATECHANGE resource uuid: ${r.uuid()}"

// ONSTATECHANGE resource uuid: 854514fb-9456-4765-ae8c-6d93033ca3de

I am trying to keep a hash of currently opened resource ids so that I can clean up any data once the connection closes. I feel like this is a bug since the AtmosphereHandler documentation states that onStateChange is called when a connection is closed but if not, is there a better way to determine locally which connection terminated?

@jfarcand
Copy link
Member

Fixed in 1.1. For 1.0.x, use

  String uuid = (String) r.getRequest().getAttribute(SUSPENDED_ATMOSPHERE_RESOURCE_UUID)

instead of

 r.uuid();

Thanks!

jfarcand added a commit that referenced this issue Oct 11, 2012
@dubrie
Copy link
Author

dubrie commented Oct 11, 2012

Fantastic, thanks for the quick turn-around!

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

No branches or pull requests

2 participants