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

ably-common integration #6

Merged
merged 14 commits into from
Apr 28, 2015
Merged

ably-common integration #6

merged 14 commits into from
Apr 28, 2015

Conversation

bladeSk
Copy link
Contributor

@bladeSk bladeSk commented Apr 17, 2015

Tests now use shared fixtures from ably-common submodule
Pagination updated to match the new spec ably/ably-js#28 (comment)

bladeSk added 4 commits April 15, 2015 15:55
Updated tests to use fixture shared across platforms
Removed superfluous CapabilityTest suite (unrelated to client library)
@kouno
Copy link
Contributor

kouno commented Apr 17, 2015

It looks pretty good. A few details on variable names but I think that's it.

Since you have a commit mentioning an incompatibility for PHP < 5.6, maybe we should add it in our travis CI?

@bladeSk
Copy link
Contributor Author

bladeSk commented Apr 17, 2015

Alright, just a sec.
PHP versions > 5.3 are basically a superset of 5.3, so it should be enough to run the tests on 5.3. While it's possible to have Travis check all the versions, that would take 4 times as much time (5.3, 5.4, 5.5, 5.6).

@kouno
Copy link
Contributor

kouno commented Apr 17, 2015

Ok so let's just say 5.3 for my peace of mind ;).

@bladeSk
Copy link
Contributor Author

bladeSk commented Apr 17, 2015

@kouno So I started adding the getter for better readability and then I realized how messy the tests are (especially TestOption was super incomprehensible) and cleaned up all of them :)

PHP 5.3 support is troublesome. It doesn't always have openssl bundled (required for AES) and has outdated versions of curl and whatnot, so it's behaving oddly. I'll have to investigate that later.

@bladeSk
Copy link
Contributor Author

bladeSk commented Apr 17, 2015

Sigh, the tests didn't pass, because sandbox has crashed again. But, if you check the log, everything else is OK.

bladeSk added 3 commits April 22, 2015 18:13
Added more universal and mockable HTTP class
Added logging class
Added proper authUrl, authCallback support to Auth
Fixed a lot of naming issues of parameters and previously ignored parameters (log level, log callback, authParams, ...)
Preliminary support for fallback servers
Added classes for options (AuthOptions, ClientOptions) and tokens (TokenParams, TokenRequest, TokenDetails)
Updated AuthTest
Test for authUrl
… instead of issued_at, clientId instead of client_id, etc.)

Bug fixes - auth token not base64 encoded, custom logger callback
@bladeSk
Copy link
Contributor Author

bladeSk commented Apr 27, 2015

Pushed the latest changes. I didn't realize this PR was still pending, so it got merged into this huge one.
See the commit messages for details, but tl;dr summary is - huge rewrite and clean up of AblyRest, introduction of types for Tokens, Options, etc,,prepared code for automatic fallback servers.

@bladeSk
Copy link
Contributor Author

bladeSk commented Apr 27, 2015

Added automatic token renewal.

@mattheworiordan
Copy link
Member

Looking good, nice to see some progress on both auth & fallbacks.

@bladeSk
Copy link
Contributor Author

bladeSk commented Apr 28, 2015

The current logic is to try normal host and then fallback hosts (a-e). On failure, the first host that worked will be used from that point on throughout the session until there's another failure.
Exceptions get rethrown, as you suggested and a (hopefully) meaningful error message is logged.

@kouno
Copy link
Contributor

kouno commented Apr 28, 2015

This PR is a bit too big now. Shall we just merge it as it passes CI and address the feedback in a follow up PR? @mattheworiordan @bladeSk

@bladeSk
Copy link
Contributor Author

bladeSk commented Apr 28, 2015

Absolutely. I could then submit the library to packagist and see if it's working properly with composer.

kouno added a commit that referenced this pull request Apr 28, 2015
ably-common integration
@kouno kouno merged commit ff95d7d into ably:master Apr 28, 2015
@mattheworiordan
Copy link
Member

In regards to the host shuffling, reading the code it is not obvious what is going on. I would definitely prefer that every request always tries the default host first, and then tries a random fallback host in order after. If you want to retain the last known good fallback host at the top of that list that is fine, however the initial request should always go to rest.ably.io first for every request. Therefore, please can this be refactored so that any developer reading this code can understand what happens clearly from the code.

@bladeSk
Copy link
Contributor Author

bladeSk commented Apr 28, 2015

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

Successfully merging this pull request may close these issues.

3 participants