Closed danawhite closed 8 years ago
Hmm, is "open" actually a valid event type? I just started using LiveQuery within the last couple weeks but I thought create, update, leave, enter and delete were the only types (https://github.com/ParsePlatform/parse-server/wiki/Parse-LiveQuery-Protocol-Specification).
@chesterhawkins according to the Parse JavaScript guide, open is a valid event. Am I referencing old information? http://parseplatform.github.io/docs/js/guide/#live-queries
To that end, do you see anything in my configuration that differs from yours that would cause events to not emit in my code?
Our configs are pretty much the same. Any luck yet? Might be a dumb question, but have you tried triggering the create event yet by creating a user with that username after starting up the server?
@danawhite if the user is already created, you won't have any event.
@chesterhawkins @flovilmart what versions of React, RN and Parse are you using to yield successful emitting of events other than an error event?
When I add the following:
Parse.LiveQuery.on('error', (error) => { console.log('Parse LiveQuery Error', error); });
I get a ton of errors in the debug console, but no other event types.
Using iOS SDK and working on the Android one. Not checking ACL's as we're only working with publicly accessible objects
Thanks. I was encountering too many roadblocks..decided to rip out Parse in favor of Firebase. It took maybe 4 hours to get up to speed and have things functioning properly.
hey @danawhite, I know you already ripped out the Parse code but do you mind telling me where you placed the client code?
`let query = new Parse.Query('Class');`
`query.equalTo("username", "dana@gmail.com");
let subscription = query.subscribe();`
console.log(subscription); <-- this shows up in the console
subscription.on('open', () => {
console.log('subscription opened'); <-- this does not
});
subscription.on('create', (object) => {
console.log(`${object} created.`) <-- neither does this
})`
Currently going down a potential rabbit hole with the live query implementation
Will,
I believe that code resided in the root of my app. I am using React Native so the file was index.ios.js.
Based on the fact that I was never able to get it working and that there does not seem to be much support for Live Query online these days, I would suggest that you count your losses and migrate to another backend solution. It literally took me 4 hours to replace Parse with Firebase and get the real-time database piece working on a basic level.
On Wed, Nov 23, 2016 at 10:34 AM, Will Yang notifications@github.com wrote:
Currently going down a potential rabbit hole with the live query implementation
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ParsePlatform/parse-server/issues/2861#issuecomment-262548013, or mute the thread https://github.com/notifications/unsubscribe-auth/ABrADW1dWYgaTHvz0Sed_R98MpOlxoAkks5rBFz2gaJpZM4KUxIQ .
Ok I'll play around with this some more and if it still doesn't work I'll look into FireBase. Thanks for your help.
On Wed, Nov 23, 2016 at 11:12 AM, Dana A. White notifications@github.com wrote:
Will,
I believe that code resided in the root of my app. I am using React Native so the file was index.ios.js.
Based on the fact that I was never able to get it working and that there does not seem to be much support for Live Query online these days, I would suggest that you count your losses and migrate to another backend solution. It literally took me 4 hours to replace Parse with Firebase and get the real-time database piece working on a basic level.
On Wed, Nov 23, 2016 at 10:34 AM, Will Yang notifications@github.com wrote:
Currently going down a potential rabbit hole with the live query implementation
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ParsePlatform/parse-server/issues/2861#issuecomment- 262548013, or mute the thread https://github.com/notifications/unsubscribe-auth/ABrADW1dWYgaTHvz0Sed_ R98MpOlxoAkks5rBFz2gaJpZM4KUxIQ .
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ParsePlatform/parse-server/issues/2861#issuecomment-262559010, or mute the thread https://github.com/notifications/unsubscribe-auth/AGGZYbkrc2pYLZgAgKv7Rzf_NZSJ_hgxks5rBGXUgaJpZM4KUxIQ .
@willyyang do you store your subscription somewhere in your JS code?
@flovilmart
componentDidMount() {
console.log('in componentDidMount')
let query = new Parse.Query('Donations');
query.equalTo('transporterId', '');
this.subscription = query.subscribe();
this.subscription.on('create', (donation) => {
console.log('created donation')
console.log(donation.get('transporterId')); // This should output `test`
});
this.subscription.on('update', (donation) => {
console.log('THIS IS NOT WORKING')
console.log(donation.get('transporterId')); // This should output `test`
});
}
Im putting it in componentDidMount
... The subscription to create works, but the subscription to updates does not.
But your query only filters transporterId = '', so that makes sense that your subscription is not updated...
yup I figured that out now. thanks.
On Wed, Nov 23, 2016 at 11:56 AM, Florent Vilmart notifications@github.com wrote:
But your query only filters transporterId = '', so that makes sense that your subscription is not updated...
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ParsePlatform/parse-server/issues/2861#issuecomment-262571649, or mute the thread https://github.com/notifications/unsubscribe-auth/AGGZYWmEBY1N2PIyb2m4afqucrIVXmcZks5rBHBXgaJpZM4KUxIQ .
I was having this exact problem when trying to configure livequery using a server port like 80300 in a local installation ( I left parse server port at 1337 ). There were no errors or messages or nothing, it just didn't work. As soon as I defined a port like 8030 for live query it all started working and 'open' and 'create' events are now receiving events perfectly.
Note that in the client I also had to manually setup the livequery URL using: Parse.liveQueryServerURL = "ws://localhost:8030"
hi @willyyang , could you tell me if query.containsAll is can use or not ? I try equalTo and containsAll not work
guys , I m facing the same , only OPEN event works, others events doesn't work..
@thunderwin Can you open a new issue and fill out the template?
guys , I m facing the same , only OPEN event works, others events doesn't work..
This is probably because you did not add it to liveQuery: { classNames: [...] }
in the server.
Hey everyone, I'm facing the same issue, the clients receives the "open" event but no "create" or "update" events.
Server configuration running Parse Server ^4.5.0:
var app = express();
app.use(compression());
app.enable('trust proxy');
app.use(bodyParser.json({limit: '50mb'}));
app.use(compression());
app.use(cookieParser());
app.use(device.capture());
app.use('/parse', new ParseServer({
databaseURI: DATABASE_URI,
appId: APP_ID,
masterKey: MASTER_KEY,
serverURL: 'http://localhost/parse',
cloud: __dirname + '/cloud/main.js',
liveQuery: {
classNames: ['Order', 'Sale']
}
}));
app.set('view engine', 'ejs');
app.use('/', routes);
const httpServer = require('http').createServer(app);
httpServer.listen(80);
var parseLiveQueryServer = ParseServer.createLiveQueryServer(httpServer);
And my JS client setup running on the latest version available on NPMCDN:
Parse.initialize(APP_ID);
Parse.serverURL = 'http://localhost/parse';
var query = new Parse.Query('Sale');
query.equalTo('status','pending');
var subscription = await query.subscribe();
subscription.on('open', () => {
console.log('subscription opened');
});
subscription.on('create', (object) => {
console.log('object created',object);
});
subscription.on('update', (object) => {
console.log('object updated',object);
});
Any ideas?
Hi everyone.. I'm facing the same issue.. My open event is triggered.. but my create and update events are not working.. i'm writing my client in angular.. Kindly inform how did you resolve your issue..??
guys , I m facing the same , only OPEN event works, others events doesn't work..伙计们,我面临着同样的问题,只有 OPEN 事件有效,其他事件不起作用..
This is probably because you did not add it to
liveQuery: { classNames: [...] }
in the server.这可能是因为你没有将其添加到liveQuery: { classNames: [...] }
在服务器中。
how about use live query in docker compose config ? this is s my config
parse-server:
depends_on:
- mongodb
image: parseplatform/parse-server:latest
container_name: parse-server
networks:
mynetwork:
ipv4_address: 172.18.1.101
ports:
- "1337:1337"
restart: always
environment:
PARSE_SERVER_APPLICATION_ID: xxxx
PARSE_SERVER_MASTER_KEY: xxxx
PARSE_SERVER_DATABASE_URI: mongodb://xxx:yr12H4dLe8wdxF@172.18.1.100:27017/dev?authSource=admin
PARSE_SERVER_MASTER_KEY_IPS: "0.0.0.0/0"
PARSE_SERVER_CLOUD: "./cloud/main.js"
PARSE_SERVER_CORS: true # 启用CORS
PARSE_SERVER_LIVE_QUERY: true # 启用LiveQuery
PARSE_SERVER_LIVE_QUERY_SERVER_OPTIONS: '{"classNames":["UserStatus"]}' # 监控类名
#PARSE_SERVER_CLOUD_CODE_MAIN: "/parse-server/cloud/"
volumes:
#- ./config/parse-config.json:/parse-server/config.json
- ./cloud:/parse-server/cloud
- ./log:/parse-server/logs
I am attempting to use LiveQuery subscriptions in a React Native project that I am currently building. The goal to facilitate communication and real-time updates between multiple devices. I have managed to configure my Parse and LiveQuery servers successfully. However, when I declare a subscription in my client code, I am not seeing the log statements in the console that were added for verification. I do, however, see that the subscription was created successfully. See below.
Server code:
);
ParseServer.createLiveQueryServer(httpServer);
When I start the server, I see the following:
parse server running on port 1337 info: Parse LiveQuery Server starts running
On the client side...
{
Expected Results
My expectation is that I would see the logs that would essentially verify that the subscription/socket is open so that I can write my logic accordingly.
Environment Setup
React Native 0.34.1