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

websocket.close fails when client's underlying session is removed from session storage #24

Open
dwkd opened this issue Mar 22, 2021 · 0 comments

Comments

@dwkd
Copy link

dwkd commented Mar 22, 2021

I am trying to have the server broadcast to a channel but before that, close all websockets of users who's web portal session has timed out.

I have the following steps:

  • Client logs in to application
  • a cf session is created in my session storage database cf_session_data
  • Client opens a WS to a registered Channel, handshake is successful
  • Server broadcasts a message
  • Client receives message successfully
  • I delete the session row from the cf_session_data (simulating a logout ... it's typical for lucee5 to remove the row on logout)
  • Server attempts to broadcast a new message, with the following steps:
    1. Looping through WebsocketsConnectionManager.getChannel( channelId).getSubscribers()
    2. Grabbing the web portal CFID from each subscriber's websocket.CFID (I create this property onOpen the first time they connect)
    3. Verify if cf_session_data contains any sessions with that CFID
    4. perform websocket.close()
    5. Server throws an uncatchable 500 error
    6. My workaround is to perform a websocket.unsubscribeAll() and after that a websocket.setMaxIdleTimeout(1). Both of these methods seem to still work, but it's a pretty janky workaround as it simply times out the socket. (On a sidenote here setMaxIdleTimeout is not implemented correctly. The argument should be milliseconds but they are actually seconds, as the 1 in this case is not immediate but actually takes 1 second to close the socket. I tried putting 5 and counted to 5 and lo and behold, again, behaves like seconds not milliseconds)
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