Skip to content

Allows disconnected to pass code and reason#37

Open
zedtux wants to merge 1 commit into
NullVoxPopuli:masterfrom
zedtux:patch-1
Open

Allows disconnected to pass code and reason#37
zedtux wants to merge 1 commit into
NullVoxPopuli:masterfrom
zedtux:patch-1

Conversation

@zedtux

@zedtux zedtux commented Nov 8, 2023

Copy link
Copy Markdown

No description provided.

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@NullVoxPopuli

Copy link
Copy Markdown
Owner

Hi @zedtux ! thanks for the PR! can you add information about this to the README as well? thanks!

@zedtux

zedtux commented Nov 10, 2023

Copy link
Copy Markdown
Author

Done sir!

@zedtux

zedtux commented Nov 14, 2023

Copy link
Copy Markdown
Author

Any news please?

Comment thread README.md

The available hooks to tie in to are:
- `disconnected {}`
- `disconnected { |code, reason| }`

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's been a while for me, but where would someone find out what possible codes and reasons could be passed here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea! The last one I had was reason being AuthError, I don't remember the code.

I guess you can find it from the ActionCable protocol specification, but Is that important for this PR?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nah, thanks! It's just been ages since I've worked with Rails' things

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@NullVoxPopuli

Copy link
Copy Markdown
Owner

it seems CI isn't set up on this repo 😅 would you be willing to PR a GH action workflow that sets that up?
Travis no longer does anything, but this was the config used: https://github.com/NullVoxPopuli/action_cable_client/blob/master/.travis.yml

@zedtux

zedtux commented Nov 16, 2023

Copy link
Copy Markdown
Author

I'm not sure I can create a PR with that and get it running on your repo, is there any kind of permissions for that?

@NullVoxPopuli

NullVoxPopuli commented Nov 16, 2023

Copy link
Copy Markdown
Owner

We'll find out! 🎉

@StantonMatt

Copy link
Copy Markdown
Contributor

I took a quick maintenance pass here while working on the CI/lint setup requested above.

Local validation on this branch:

  • bundle exec rspec -> 49 examples, 0 failures
  • bundle exec ruby -Ilib -e 'require "action_cable_client"; client = ActionCableClient.new("ws://example.test/cable", "RoomChannel", false); received = nil; client.disconnected { |code, reason| received = [code, reason] }; client._disconnected_callback.call(1000, "normal"); raise received.inspect unless received == [1000, "normal"]; puts "disconnect callback args ok"' -> disconnect callback args ok

I also opened #41 to restore GitHub Actions/RuboCop for the repo, since missing CI was the blocker discussed here. Once that lands, this PR should have a path to real CI coverage too. Happy to help add a focused spec for the close code/reason behavior if that would make review easier.

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

Successfully merging this pull request may close these issues.

3 participants