You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.
I have configured a parse-server running LiveQuery on Amazon EC2 instance, on port 9091, with no proxy, firewall configurations made. It seems to be working fine, because we tested on React and using http://www.websocket.org/echo.html, telling that the connection was successful.
However on iOS, I couldn't make LiveQuery work, even though the handleSubscribe seems to be ok.
I've created a simple viewController to try it:
import UIKit
import Parse
import ParseLiveQuery
class StatsViewController: UIViewController {
//MARK: - Outlets
@IBAction func insertMessage(sender: AnyObject) {
let message = Message();
message.author = PFUser.currentUser()
message.authorName = message.author?.username
message.text = "Hello: \(NSDate())"
message.roomName = "Test";
message.saveInBackground();
}
//MARK: - Variables
var myQuery: PFQuery {
return (Message.query()?
.whereKey("roomName", equalTo: "Test")
.orderByAscending("createdAt"))!
}
var subscription: Subscription<Message>? = nil
//MARK: - Lifecycle
override func viewDidLoad() {
super.viewDidLoad()
//Registers the subclass
Message.registerSubclass();
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func viewDidAppear(animated: Bool) {
//1) queries for messages, working.
myQuery.findObjectsInBackground().continueWithBlock() { res in
for msg in ((res.result as? [Message]))! {
print(msg);
}
return nil
}
//2) try to subscribe and receive any information from the server
subscription = myQuery.subscribe()
subscription!.handleEvent { query, event in
// Handle event
print("any event, please?"); //no events handled after creating a new message
}
subscription!.handle(Event.Created) { query, object in
// Called whenever an object was created
print("any creation, please?"); //no events handled after creating a new message
}
subscription!.handleError { (query, err) in
print("any error, please?"); //no errors handled
}
subscription!.handleSubscribe { query in
print("subscribed")
}
}
}
I also tried the subscription using the code in the parse example, like in
After lots of headaches, trials, errors and studying the examples, I couldn't receive any event on iOS after subscribing to Parse LiveQuery.
There's another thread on stack overflow with the same problem: http://stackoverflow.com/questions/37012451/livequery-not-responding
and now mine:
http://stackoverflow.com/questions/37381388/parse-livequery-subscription-doesnt-receive-any-events
I have configured a parse-server running LiveQuery on Amazon EC2 instance, on port 9091, with no proxy, firewall configurations made. It seems to be working fine, because we tested on React and using http://www.websocket.org/echo.html, telling that the connection was successful.
However on iOS, I couldn't make LiveQuery work, even though the handleSubscribe seems to be ok.
I've created a simple viewController to try it:
I also tried the subscription using the code in the parse example, like in
some information
Is there any mistake or something missing in the subscription process?
Thanks!
The text was updated successfully, but these errors were encountered: