forked from apollographql/apollo-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
graphql-ws
protocol support (apollographql#2168)
* Implement graphql-transport-ws protocol support * Add graphql-transport-ws integration test based on Apollo Server docs-examples * Add CI step for Apollo Server graphql-transport-ws tests * After installing node v12 switch to use v16 * Instruct nvm to use version in .nvmrc * Update documentation and tutorial * Change WSProtocol cases to closer match library names * Remove initializer defaults and require web socket protocol on designated initializer. * Update Subscriptions documentation * Add WSProtocol option for AWS AppSync * Add ping/pong message support required by graphql-ws * Update documentation and tutorial * Add tests for subscriptionWsProtocol * Add tests for graphqlWSProtocol * Revert to naming aligned with the protocols and not the implementation libraries * Use longer async timeout for slower environments like CI * Fix test names * Fix project configuration * Rename protocol parameter on WebSocket initializers * Revert "Use longer async timeout for slower environments like CI" * Fix async timing bug and refactor websocket protocol tests
- Loading branch information
1 parent
8d6d114
commit 8286ee4
Showing
29 changed files
with
1,041 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
Apollo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#include "../Shared/Workspace-Universal-Framework.xcconfig" | ||
|
||
INFOPLIST_FILE = Sources/SubscriptionAPI/Info.plist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v12.22.10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import Foundation | ||
@testable import ApolloWebSocket | ||
|
||
public class MockWebSocketDelegate: WebSocketClientDelegate { | ||
public var didReceiveMessage: ((String) -> Void)? | ||
|
||
public init() {} | ||
|
||
public func websocketDidConnect(socket: WebSocketClient) {} | ||
|
||
public func websocketDidDisconnect(socket: WebSocketClient, error: Error?) {} | ||
|
||
public func websocketDidReceiveMessage(socket: WebSocketClient, text: String) { | ||
didReceiveMessage?(text) | ||
} | ||
|
||
public func websocketDidReceiveData(socket: WebSocketClient, data: Data) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// @generated | ||
// This file was automatically generated and should not be edited. | ||
|
||
import Apollo | ||
import Foundation | ||
|
||
public final class IncrementingSubscription: GraphQLSubscription { | ||
/// The raw GraphQL definition of this operation. | ||
public let operationDefinition: String = | ||
""" | ||
subscription Incrementing { | ||
numberIncremented | ||
} | ||
""" | ||
|
||
public let operationName: String = "Incrementing" | ||
|
||
public let operationIdentifier: String? = "fe12b5f0dfc7fefa513cc8aecef043b45daf2d776fd000d3a7703f9798ecf233" | ||
|
||
public init() { | ||
} | ||
|
||
public struct Data: GraphQLSelectionSet { | ||
public static let possibleTypes: [String] = ["Subscription"] | ||
|
||
public static var selections: [GraphQLSelection] { | ||
return [ | ||
GraphQLField("numberIncremented", type: .scalar(Int.self)), | ||
] | ||
} | ||
|
||
public private(set) var resultMap: ResultMap | ||
|
||
public init(unsafeResultMap: ResultMap) { | ||
self.resultMap = unsafeResultMap | ||
} | ||
|
||
public init(numberIncremented: Int? = nil) { | ||
self.init(unsafeResultMap: ["__typename": "Subscription", "numberIncremented": numberIncremented]) | ||
} | ||
|
||
public var numberIncremented: Int? { | ||
get { | ||
return resultMap["numberIncremented"] as? Int | ||
} | ||
set { | ||
resultMap.updateValue(newValue, forKey: "numberIncremented") | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>en</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>FMWK</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>$(CURRENT_PROJECT_VERSION)</string> | ||
<key>CFBundleVersion</key> | ||
<string>$(CURRENT_PROJECT_VERSION)</string> | ||
<key>NSPrincipalClass</key> | ||
<string></string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#import <Foundation/Foundation.h> | ||
|
||
//! Project version number for SubscriptionAPI. | ||
FOUNDATION_EXPORT double SubscriptionAPIVersionNumber; | ||
|
||
//! Project version string for SubscriptionAPI. | ||
FOUNDATION_EXPORT const unsigned char SubscriptionAPIVersionString[]; | ||
|
||
// In this header, you should import all the public headers of your framework using statements like #import <SubscriptionAPI/PublicHeader.h> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"fe12b5f0dfc7fefa513cc8aecef043b45daf2d776fd000d3a7703f9798ecf233": { | ||
"name": "Incrementing", | ||
"source": "subscription Incrementing {\n numberIncremented\n}" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
type Query { | ||
currentNumber: Int | ||
} | ||
|
||
type Subscription { | ||
numberIncremented: Int | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
subscription Incrementing { | ||
numberIncremented | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.