Adds websocket updates via the /updates endpoint
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#import "MBIMBridge_Private.h"
|
||||
#import "MBIMBridgeOperation.h"
|
||||
#import "MBIMAuthToken.h"
|
||||
#import "MBIMUpdateQueue.h"
|
||||
|
||||
#import <Security/Security.h>
|
||||
#import <CocoaHTTPServer/HTTPMessage.h>
|
||||
@@ -107,6 +108,7 @@
|
||||
if (operationClass != nil) {
|
||||
_currentOperation = [[operationClass alloc] initWithRequestURL:url completion:completion];
|
||||
_currentOperation.requestBodyData = _bodyData;
|
||||
_currentOperation.request = self->request;
|
||||
|
||||
[[[MBIMBridge sharedInstance] operationQueue] addOperation:_currentOperation];
|
||||
long status = dispatch_semaphore_wait(sema, dispatch_time(DISPATCH_TIME_NOW, (int64_t)(60.0 * NSEC_PER_SEC)));
|
||||
@@ -124,6 +126,17 @@
|
||||
return response;
|
||||
}
|
||||
|
||||
- (WebSocket *)webSocketForURI:(NSString *)path
|
||||
{
|
||||
NSURL *url = [NSURL URLWithString:path];
|
||||
NSString *endpointName = [url lastPathComponent];
|
||||
if ([endpointName isEqualToString:@"updates"]) {
|
||||
return [[MBIMUpdateQueue sharedInstance] vendUpdateWebSocketConsumerForRequest:request socket:asyncSocket];
|
||||
}
|
||||
|
||||
return [super webSocketForURI:path];
|
||||
}
|
||||
|
||||
- (BOOL)expectsRequestBodyFromMethod:(NSString *)method atPath:(NSString *)path
|
||||
{
|
||||
if ([method isEqualToString:@"POST"]) {
|
||||
|
||||
Reference in New Issue
Block a user