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 regression in 0.9.98 #3422

Closed
themadsens opened this issue Mar 12, 2023 · 8 comments
Closed

Websocket regression in 0.9.98 #3422

themadsens opened this issue Mar 12, 2023 · 8 comments

Comments

@themadsens
Copy link

themadsens commented Mar 12, 2023

My websocket integration with Amplex GridLight broke in 0.9.98

Immediately after opening the url: wss://demo.gridlight.dk/changes

I get a callback with type="fail", message=nil

with 0.9.97 I get (as expected) type="open", message=nil and then type="received", message="authenticate"

@cmsj
Copy link
Member

cmsj commented Mar 13, 2023

Thanks for the report. I upgraded the websocket library we use, which may be related. Is there a simple snippet I can use to reproduce what you're seeing? (Or would that need authentication?)

@themadsens
Copy link
Author

themadsens commented Mar 13, 2023

Thank for noticing :-). No, the following snippet should be enough to reproduce the above behaviour:
The server is online, and the error actually prevents the "authenticate" step. It does not even get to saying "open"

  local wsUrl = "wss://demo.gridlight.dk/changes"
  print("WS open", wsUrl)
  ws = hs.websocket.new(wsUrl, function(typ, msg) 
      print("WS:", typ, msg)
  end)

@cmsj
Copy link
Member

cmsj commented Mar 13, 2023

ws = hs.websocket.new("wss://demo.gridlight.dk/changes", function(state, message) print(state) print(message) end)

appears to be sufficient to reproduce what you're seeing.

@cmsj
Copy link
Member

cmsj commented Mar 13, 2023

Hah, I hadn't refreshed this tab in the last hour, so I missed you had also posted a reproducer. Thanks! I'll take a look and see if I can figure out what's going wrong.

@cmsj
Copy link
Member

cmsj commented Mar 13, 2023

Yeah this is definitely broken. Looks like it might be an issue in SocketRocket (the underlying library we're using for websockets), which, worryingly, hasn't been updated since 2021. I'll revert to the earlier version of the library (PR is up already, #3424 ) and get a new Hammerspoon release out. Thanks again!

@cmsj cmsj closed this as completed in 864bbd8 Mar 13, 2023
@Moulick
Copy link

Moulick commented Mar 13, 2023

@latenitefilms
Copy link
Contributor

I wonder if this change has anything to do with it?

5271943

@cmsj
Copy link
Member

cmsj commented Mar 14, 2023

@latenitefilms I don't think so, that was just the underlying library separating out one method into two, but I dunno, better to revert quickly and take our time in figuring out a way forward (which may involve moving away from SocketRocket entirely - NSURLSession supports websockets in our minimum macOS version)

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

4 participants