Parse Live Query: Not receiving Events on iOS Client. Our Parse server hosted on Azure App Services












0















Issue Description



We have hosted Parse server on Azure App Services. We are able to connect to live Query and able to Subscribe to it. We are getting below messages.



2019-01-01 19:03:26.917094+0530 LiveQueryTest[59625:972922] ParseLiveQuery: Sending message:



{"clientKey":"xxxxxx","op":"connect","sessionToken":"","applicationId":"xxxxxx"}
2019-01-01 19:03:27.285251+0530 LiveQueryTest[59625:972922] ParseLiveQuery: Received message: {"op":"connected","clientId":5}
2019-01-01 19:03:27.388337+0530 LiveQueryTest[59625:972922] ParseLiveQuery: Sending message: {"query":{"className":"PostQuestionMessage","where":{"type":2}},"requestId":1,"op":"subscribe"}
2019-01-01 19:03:27.600455+0530 LiveQueryTest[59625:972813] ParseLiveQuery: Received message: {"op":"subscribed","clientId":5,"requestId":1}


And we are subscribed to Update Event but when we updated any records we are not getting event Back.



On the server:



We tried to listen to Specific port "1337" as below: Every time we do that our Parse Dashboard and API stops working. So Is it necessary to listen to specific port i.e "1337" or var port = process.env.PORT || 1337; will also work for Live Query.



var httpServer = require('http').createServer(app);
var port = 1337;
httpServer.listen(port, function() {
console.log('Parse Server running at ${port}');
console.log("The value of port is " + port);
});
ParseServer.createLiveQueryServer(httpServer);


Expected Results



We should get the event update as per our subscription.



Actual Outcome



Not receiving event updates as per the Query Subscribed,



Environment Setup



Server



parse-server version (Be specific! Don't say 'latest'.) : [2.3.8]



Operating System: [Linux]



[Remote Server - Azure]



Database



MongoDB version: [3.4]



[Remote Server - Azure]



Logs/Trace



Server:



[32minfo�[39m: Parse LiveQuery Server starts running



�[32minfo�[39m: Create new client: 1



iOS client Code:



import UIKit
import Parse
import ParseLiveQuery

class LiveQueryManager {
static let shared = LiveQueryManager()
var liveQueryClient = ParseLiveQuery.Client()
var subscription: Subscription<PostQuestionMessage>?
var messagesQuery: PFQuery<PostQuestionMessage> {
return (PostQuestionMessage.query()?
.whereKey("type", equalTo: 2)) as! PFQuery<PostQuestionMessage>
}
init(){
liveQueryClient.shouldPrintWebSocketLog = true
liveQueryClient.shouldPrintWebSocketTrace = true
}
fileprivate func printMessage(_ message: PostQuestionMessage) {
let createdAt = message.createdAt ?? Date()
print("(createdAt) : (message.message ?? "")")
}

func subscribeToUpdates() {

//https://stackoverflow.com/questions/44273455/parse-cloud-livequeries-ios-client-doesnt-work
self.subscription = self.liveQueryClient.subscribe(messagesQuery)
self.subscription = self.subscription?.handleEvent({ (_, event) in
switch event {
case .created(let object):
print("Event Created")
self.printMessage(object)
// do stuff
case .updated(let object):
print("Event Updated")
self.printMessage(object)

default:
break // do other stuff or do nothing
}
})

}
func disconnectFromSubscription() {
if let objSubcription = self.subscription {
self.liveQueryClient.unsubscribe(messagesQuery, handler: objSubcription)
}

}
func printSubscription () {
if let objSubscription = self.subscription {
print ("Subscription:(objSubscription)")
print ("Client:(self.liveQueryClient)")
print ("Client userDisconnected:(self.liveQueryClient.userDisconnected)")
}
}


}









share|improve this question





























    0















    Issue Description



    We have hosted Parse server on Azure App Services. We are able to connect to live Query and able to Subscribe to it. We are getting below messages.



    2019-01-01 19:03:26.917094+0530 LiveQueryTest[59625:972922] ParseLiveQuery: Sending message:



    {"clientKey":"xxxxxx","op":"connect","sessionToken":"","applicationId":"xxxxxx"}
    2019-01-01 19:03:27.285251+0530 LiveQueryTest[59625:972922] ParseLiveQuery: Received message: {"op":"connected","clientId":5}
    2019-01-01 19:03:27.388337+0530 LiveQueryTest[59625:972922] ParseLiveQuery: Sending message: {"query":{"className":"PostQuestionMessage","where":{"type":2}},"requestId":1,"op":"subscribe"}
    2019-01-01 19:03:27.600455+0530 LiveQueryTest[59625:972813] ParseLiveQuery: Received message: {"op":"subscribed","clientId":5,"requestId":1}


    And we are subscribed to Update Event but when we updated any records we are not getting event Back.



    On the server:



    We tried to listen to Specific port "1337" as below: Every time we do that our Parse Dashboard and API stops working. So Is it necessary to listen to specific port i.e "1337" or var port = process.env.PORT || 1337; will also work for Live Query.



    var httpServer = require('http').createServer(app);
    var port = 1337;
    httpServer.listen(port, function() {
    console.log('Parse Server running at ${port}');
    console.log("The value of port is " + port);
    });
    ParseServer.createLiveQueryServer(httpServer);


    Expected Results



    We should get the event update as per our subscription.



    Actual Outcome



    Not receiving event updates as per the Query Subscribed,



    Environment Setup



    Server



    parse-server version (Be specific! Don't say 'latest'.) : [2.3.8]



    Operating System: [Linux]



    [Remote Server - Azure]



    Database



    MongoDB version: [3.4]



    [Remote Server - Azure]



    Logs/Trace



    Server:



    [32minfo�[39m: Parse LiveQuery Server starts running



    �[32minfo�[39m: Create new client: 1



    iOS client Code:



    import UIKit
    import Parse
    import ParseLiveQuery

    class LiveQueryManager {
    static let shared = LiveQueryManager()
    var liveQueryClient = ParseLiveQuery.Client()
    var subscription: Subscription<PostQuestionMessage>?
    var messagesQuery: PFQuery<PostQuestionMessage> {
    return (PostQuestionMessage.query()?
    .whereKey("type", equalTo: 2)) as! PFQuery<PostQuestionMessage>
    }
    init(){
    liveQueryClient.shouldPrintWebSocketLog = true
    liveQueryClient.shouldPrintWebSocketTrace = true
    }
    fileprivate func printMessage(_ message: PostQuestionMessage) {
    let createdAt = message.createdAt ?? Date()
    print("(createdAt) : (message.message ?? "")")
    }

    func subscribeToUpdates() {

    //https://stackoverflow.com/questions/44273455/parse-cloud-livequeries-ios-client-doesnt-work
    self.subscription = self.liveQueryClient.subscribe(messagesQuery)
    self.subscription = self.subscription?.handleEvent({ (_, event) in
    switch event {
    case .created(let object):
    print("Event Created")
    self.printMessage(object)
    // do stuff
    case .updated(let object):
    print("Event Updated")
    self.printMessage(object)

    default:
    break // do other stuff or do nothing
    }
    })

    }
    func disconnectFromSubscription() {
    if let objSubcription = self.subscription {
    self.liveQueryClient.unsubscribe(messagesQuery, handler: objSubcription)
    }

    }
    func printSubscription () {
    if let objSubscription = self.subscription {
    print ("Subscription:(objSubscription)")
    print ("Client:(self.liveQueryClient)")
    print ("Client userDisconnected:(self.liveQueryClient.userDisconnected)")
    }
    }


    }









    share|improve this question



























      0












      0








      0








      Issue Description



      We have hosted Parse server on Azure App Services. We are able to connect to live Query and able to Subscribe to it. We are getting below messages.



      2019-01-01 19:03:26.917094+0530 LiveQueryTest[59625:972922] ParseLiveQuery: Sending message:



      {"clientKey":"xxxxxx","op":"connect","sessionToken":"","applicationId":"xxxxxx"}
      2019-01-01 19:03:27.285251+0530 LiveQueryTest[59625:972922] ParseLiveQuery: Received message: {"op":"connected","clientId":5}
      2019-01-01 19:03:27.388337+0530 LiveQueryTest[59625:972922] ParseLiveQuery: Sending message: {"query":{"className":"PostQuestionMessage","where":{"type":2}},"requestId":1,"op":"subscribe"}
      2019-01-01 19:03:27.600455+0530 LiveQueryTest[59625:972813] ParseLiveQuery: Received message: {"op":"subscribed","clientId":5,"requestId":1}


      And we are subscribed to Update Event but when we updated any records we are not getting event Back.



      On the server:



      We tried to listen to Specific port "1337" as below: Every time we do that our Parse Dashboard and API stops working. So Is it necessary to listen to specific port i.e "1337" or var port = process.env.PORT || 1337; will also work for Live Query.



      var httpServer = require('http').createServer(app);
      var port = 1337;
      httpServer.listen(port, function() {
      console.log('Parse Server running at ${port}');
      console.log("The value of port is " + port);
      });
      ParseServer.createLiveQueryServer(httpServer);


      Expected Results



      We should get the event update as per our subscription.



      Actual Outcome



      Not receiving event updates as per the Query Subscribed,



      Environment Setup



      Server



      parse-server version (Be specific! Don't say 'latest'.) : [2.3.8]



      Operating System: [Linux]



      [Remote Server - Azure]



      Database



      MongoDB version: [3.4]



      [Remote Server - Azure]



      Logs/Trace



      Server:



      [32minfo�[39m: Parse LiveQuery Server starts running



      �[32minfo�[39m: Create new client: 1



      iOS client Code:



      import UIKit
      import Parse
      import ParseLiveQuery

      class LiveQueryManager {
      static let shared = LiveQueryManager()
      var liveQueryClient = ParseLiveQuery.Client()
      var subscription: Subscription<PostQuestionMessage>?
      var messagesQuery: PFQuery<PostQuestionMessage> {
      return (PostQuestionMessage.query()?
      .whereKey("type", equalTo: 2)) as! PFQuery<PostQuestionMessage>
      }
      init(){
      liveQueryClient.shouldPrintWebSocketLog = true
      liveQueryClient.shouldPrintWebSocketTrace = true
      }
      fileprivate func printMessage(_ message: PostQuestionMessage) {
      let createdAt = message.createdAt ?? Date()
      print("(createdAt) : (message.message ?? "")")
      }

      func subscribeToUpdates() {

      //https://stackoverflow.com/questions/44273455/parse-cloud-livequeries-ios-client-doesnt-work
      self.subscription = self.liveQueryClient.subscribe(messagesQuery)
      self.subscription = self.subscription?.handleEvent({ (_, event) in
      switch event {
      case .created(let object):
      print("Event Created")
      self.printMessage(object)
      // do stuff
      case .updated(let object):
      print("Event Updated")
      self.printMessage(object)

      default:
      break // do other stuff or do nothing
      }
      })

      }
      func disconnectFromSubscription() {
      if let objSubcription = self.subscription {
      self.liveQueryClient.unsubscribe(messagesQuery, handler: objSubcription)
      }

      }
      func printSubscription () {
      if let objSubscription = self.subscription {
      print ("Subscription:(objSubscription)")
      print ("Client:(self.liveQueryClient)")
      print ("Client userDisconnected:(self.liveQueryClient.userDisconnected)")
      }
      }


      }









      share|improve this question
















      Issue Description



      We have hosted Parse server on Azure App Services. We are able to connect to live Query and able to Subscribe to it. We are getting below messages.



      2019-01-01 19:03:26.917094+0530 LiveQueryTest[59625:972922] ParseLiveQuery: Sending message:



      {"clientKey":"xxxxxx","op":"connect","sessionToken":"","applicationId":"xxxxxx"}
      2019-01-01 19:03:27.285251+0530 LiveQueryTest[59625:972922] ParseLiveQuery: Received message: {"op":"connected","clientId":5}
      2019-01-01 19:03:27.388337+0530 LiveQueryTest[59625:972922] ParseLiveQuery: Sending message: {"query":{"className":"PostQuestionMessage","where":{"type":2}},"requestId":1,"op":"subscribe"}
      2019-01-01 19:03:27.600455+0530 LiveQueryTest[59625:972813] ParseLiveQuery: Received message: {"op":"subscribed","clientId":5,"requestId":1}


      And we are subscribed to Update Event but when we updated any records we are not getting event Back.



      On the server:



      We tried to listen to Specific port "1337" as below: Every time we do that our Parse Dashboard and API stops working. So Is it necessary to listen to specific port i.e "1337" or var port = process.env.PORT || 1337; will also work for Live Query.



      var httpServer = require('http').createServer(app);
      var port = 1337;
      httpServer.listen(port, function() {
      console.log('Parse Server running at ${port}');
      console.log("The value of port is " + port);
      });
      ParseServer.createLiveQueryServer(httpServer);


      Expected Results



      We should get the event update as per our subscription.



      Actual Outcome



      Not receiving event updates as per the Query Subscribed,



      Environment Setup



      Server



      parse-server version (Be specific! Don't say 'latest'.) : [2.3.8]



      Operating System: [Linux]



      [Remote Server - Azure]



      Database



      MongoDB version: [3.4]



      [Remote Server - Azure]



      Logs/Trace



      Server:



      [32minfo�[39m: Parse LiveQuery Server starts running



      �[32minfo�[39m: Create new client: 1



      iOS client Code:



      import UIKit
      import Parse
      import ParseLiveQuery

      class LiveQueryManager {
      static let shared = LiveQueryManager()
      var liveQueryClient = ParseLiveQuery.Client()
      var subscription: Subscription<PostQuestionMessage>?
      var messagesQuery: PFQuery<PostQuestionMessage> {
      return (PostQuestionMessage.query()?
      .whereKey("type", equalTo: 2)) as! PFQuery<PostQuestionMessage>
      }
      init(){
      liveQueryClient.shouldPrintWebSocketLog = true
      liveQueryClient.shouldPrintWebSocketTrace = true
      }
      fileprivate func printMessage(_ message: PostQuestionMessage) {
      let createdAt = message.createdAt ?? Date()
      print("(createdAt) : (message.message ?? "")")
      }

      func subscribeToUpdates() {

      //https://stackoverflow.com/questions/44273455/parse-cloud-livequeries-ios-client-doesnt-work
      self.subscription = self.liveQueryClient.subscribe(messagesQuery)
      self.subscription = self.subscription?.handleEvent({ (_, event) in
      switch event {
      case .created(let object):
      print("Event Created")
      self.printMessage(object)
      // do stuff
      case .updated(let object):
      print("Event Updated")
      self.printMessage(object)

      default:
      break // do other stuff or do nothing
      }
      })

      }
      func disconnectFromSubscription() {
      if let objSubcription = self.subscription {
      self.liveQueryClient.unsubscribe(messagesQuery, handler: objSubcription)
      }

      }
      func printSubscription () {
      if let objSubscription = self.subscription {
      print ("Subscription:(objSubscription)")
      print ("Client:(self.liveQueryClient)")
      print ("Client userDisconnected:(self.liveQueryClient.userDisconnected)")
      }
      }


      }






      ios mongodb azure parse.com livequery






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 1 at 14:09







      Nishith Sheth

















      asked Jan 1 at 14:04









      Nishith ShethNishith Sheth

      906713




      906713
























          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53996102%2fparse-live-query-not-receiving-events-on-ios-client-our-parse-server-hosted-on%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53996102%2fparse-live-query-not-receiving-events-on-ios-client-our-parse-server-hosted-on%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          MongoDB - Not Authorized To Execute Command

          How to fix TextFormField cause rebuild widget in Flutter

          in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith