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

Codes 1 and 2 not defined as contants #319

Closed
lmsmartins opened this issue Mar 16, 2017 · 2 comments
Closed

Codes 1 and 2 not defined as contants #319

lmsmartins opened this issue Mar 16, 2017 · 2 comments

Comments

@lmsmartins
Copy link

Hi,

Is there a specific reason for the codes 1 and 2 not being defined as constants? Code 1 for invalid SSL certificate and code 2 for timed out.

let error = errorWithDetail("Invalid SSL certificate", code: 1)
self?.doDisconnect(self?.errorWithDetail("write wait timed out", code: 2))

I don't like to use ==1 or ==2 in my code within the webSocketDidDisconnect function, since it makes the logic a bit harder to understand.

Perhaps we could define these codes in the CloseCode enum?

By the way, this library is super awesome! Thank you for all the hard work!

@morganzellers
Copy link

I would like to work on this if need be!

@acmacalister
Copy link
Collaborator

Not really, I think it is just a carry over from older code. An enum is a good idea. Thanks. Glad you enjoy it! @morganzellers I'm fine if you want to work on it. Should be a fairly easy change.

daltoniam added a commit that referenced this issue Jun 24, 2017
sahara108 added a commit to senagbe/Starscream that referenced this issue Jul 18, 2017
* 'master' of github.com:daltoniam/Starscream: (22 commits)
  updated podspec
  the joys of getting all the package manager to play nice
  Removed Else Clause that would sometimes give a wrong error message
  updated changelog
  updated pod spec for compression changes
  SecTrust object now is conditionally unwrapped
  spm fix
  spm fix
  package manager update
  fixes daltoniam#309, daltoniam#319, daltoniam#334
  make WSResponse values public
  Add Advanced Delegate and Custom HTTP methods
  Update README with (trite) grammar changes
  Include zlib as a module, rather than using `@_silgen_name` and redefinition.  This is less verbose and less error-prone.
  Add information about compression support to README.  Other changes based on PR feedback.
  Avoid unnecessary copying.  Confirm Autobahn fuzzing test results are comparable with the autobahn library itself.
  Fix capture memory leaks in Autobahn tester.
  Fixes to handle different windowsBits and noContextTakeover.
  Integrate compression classes.
  Add compression classes and unit tests.
  ...
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