Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# 1.6 - March 2015

* Swift and 64-bit compatibility
* Added new delegate method to support extracting auth response from wrapped payloads (#171)
* Removed SocketRocket from the public interface (#157)
* Fix deprecation warning for willAuthorizeChannelWithRequest (#147)
* Use NSDate instead of C API for setting timestamp on auth request (#133)

# 1.5 - December 2013

This release contains some significant bug fixes and API changes. All deprecated API in this release will be removed in the next release after this one.
Expand Down
3 changes: 3 additions & 0 deletions Library/PTPusher.m
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@ - (void)subscribeToChannel:(PTPusherChannel *)channel
{
[channel authorizeWithCompletionHandler:^(BOOL isAuthorized, NSDictionary *authData, NSError *error) {
if (isAuthorized && self.connection.isConnected) {
if ([self.delegate respondsToSelector:@selector(pusher:authorizationPayloadFromResponseData:)]) {
authData = [self.delegate pusher:self authorizationPayloadFromResponseData:authData];
}
[channel subscribeWithAuthorization:authData];
}
else {
Expand Down
15 changes: 15 additions & 0 deletions Library/PTPusherDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,21 @@
*/
- (void)pusher:(PTPusher *)pusher willAuthorizeChannel:(PTPusherChannel *)channel withRequest:(NSMutableURLRequest *)request;

/** Allows the delegate to return authorization data in the format required by Pusher from a
non-standard respnse.

When using a remote server to authorize access to a private channel, the server is expected to
return an authorization payload in a specific format which is then sent to Pusher when connecting
to a private channel.

Sometimes, a server might return a non-standard response, for example, the auth data may be a sub-set
of some bigger response.

If implemented, Pusher will call this method with the response data returned from the authorization
URL and will use whatever dictionary is returned instead.
*/
- (NSDictionary *)pusher:(PTPusher *)pusher authorizationPayloadFromResponseData:(NSDictionary *)responseData;

/** Notifies the delegate that the PTPusher instance has subscribed to the specified channel.

This method will be called after any channel authorization has taken place and when a subscribe event has been received.
Expand Down
2 changes: 2 additions & 0 deletions libPusher.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,10 @@
A315780A14D0751C000136A9 /* Pods.xcconfig */,
A31577F714D0731B000136A9 /* Pods-specs.xcconfig */,
);
indentWidth = 2;
name = CustomTemplate;
sourceTree = "<group>";
tabWidth = 2;
};
29B97315FDCFA39411CA2CEA /* Other Sources */ = {
isa = PBXGroup;
Expand Down