Skip to content

The example doesn't work under Graphql 11 #4

@mlillywhite

Description

@mlillywhite

Hi, the example doesn't work under GraphQL 11, presumably because of changes introduced in GraphQL 7. The following patch will fix it:

diff --git a/build.gradle b/build.gradle
index 6a916fc..94272ea 100644
--- a/build.gradle
+++ b/build.gradle
@@ -18,7 +18,7 @@ repositories {
 def jettyVersion = '9.4.5.v20170502'
 
 dependencies {
-    compile "com.graphql-java:graphql-java:6.0"
+    compile "com.graphql-java:graphql-java:11.0"
     compile "io.reactivex.rxjava2:rxjava:2.1.5"
     compile "com.fasterxml.jackson.core:jackson-databind:2.8.8.1"
     compile "com.google.code.gson:gson:2.8.0"
diff --git a/src/main/resources/httpmain/index.html b/src/main/resources/httpmain/index.html
index bd741a2..f602ee5 100644
--- a/src/main/resources/httpmain/index.html
+++ b/src/main/resources/httpmain/index.html
@@ -93,15 +93,15 @@
                 var data = event.data;
                 var msg = JSON.parse(data);
                 console.log(data);
-                var stockCode = msg.stockCode;
+                var stockCode = msg.stockQuotes.stockCode;
                 var stockList = STOCK_CODES_UPDATES[stockCode];
                 if (stockList) {
                     if (stockList.length > 7) {
                         stockList.shift()
                     }
-                    stockList.push(msg)
+                    stockList.push(msg.stockQuotes)
                 } else {
-                    STOCK_CODES_UPDATES[stockCode] = [msg];
+                    STOCK_CODES_UPDATES[stockCode] = [msg.stockQuotes];
                 }
 
                 var htmlStr = '';
@@ -169,4 +169,4 @@ subscription StockCodeSubscription {
     </div>
 </div>
 </body>
-</html>
\ No newline at end of file
+</html>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions