Skip to content

LiveQuery not sending events #3906

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
el-mail opened this issue Jun 3, 2017 · 5 comments
Closed

LiveQuery not sending events #3906

el-mail opened this issue Jun 3, 2017 · 5 comments

Comments

@el-mail
Copy link

el-mail commented Jun 3, 2017

Aloha!
i use LiveQuery in Parse JS SDK v1.9.2
LiveQueryServer running, but does not trigger LiveQuery event.
event 'create', 'update' and other does't work
example code

 var ClassObject = Parse.Object.extend(classname);
    var query = new Parse.Query(ClassObject);
    var subscription = query.subscribe();

    subscription.on('open', function(){
      console.log('open'); // open
    });
    subscription.on('create', function(obj){
      console.log('create', obj.attributes); // not working
    });
    subscription.on('update', function(obj){
      console.log('update', obj.attributes); //and here not working
      document.getElementById("json").innerHTML = JSON.stringify(obj.attributes, undefined, 2);
    });

Log on server

verbose: Request: {"op":"connect","applicationId":"","javascriptKey":""}
1|parse-wr | info: Create new client: 1
1|parse-wr | verbose: Push Response : "{\"op\":\"connected\",\"clientId\":1}"
1|parse-wr | verbose: Request: {"op":"subscribe","requestId":1,"query":{"className":"Map","where":{}}}
1|parse-wr | verbose: Push Response : "{\"op\":\"subscribed\",\"clientId\":1,\"requestId\":1}"
1|parse-wr | verbose: Create client 1 new subscription: 1
1|parse-wr | verbose: Current client number: 1

server index.js setting

'use strict'

const express = require('express');
const ParseServer = require('parse-server').ParseServer;
const path = require('path');

const databaseUri = process.env.DATABASE_URI || process.env.MONGODB_URI;

const api = new ParseServer({  
    databaseURI: databaseUri || 'mongodb://',
    cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
    appId: process.env.APP_ID || '',
    masterKey: process.env.MASTER_KEY || '',
    clientKey: process.env.CLIENT_KEY || '',
    javascriptKey: process.env.JAVASCRIPT_KEY || '',
    restAPIKey: process.env.REST_API_KEY || '',
    serverURL: process.env.SERVER_URL || 'http://localhost:1337/v2'
    verbose: true,
    liveQuery: {
        classNames: ['_User', 'Map'],
        redisURL: 'redis://localhost:6379'  
    }
});

let app = express();


app.use('/public', express.static(path.join(__dirname, '/public')));


const mountPath = process.env.PARSE_MOUNT || '/v2';
app.use(mountPath, api);


app.get('/', (req, res) => {
    res.status(200).send('api');
});

const port = process.env.PORT || 1337;
let httpServer = require('http').createServer(app);
httpServer.listen(port, () => {
    console.log(' v2.0 running on port ' + port + '.');
});
let parseLiveQueryServer = ParseServer.createLiveQueryServer(httpServer,  {
  appId: 'key',
  masterKey: 'key',
  keyPairs: {
    "restAPIKey": "key",
    "javascriptKey": "key",
    "clientKey": "key",
    "masterKey": "key"
  },
  serverURL: 'http://localhost:1337/v2',
  websocketTimeout: 10 * 1000,
  cacheTimeout: 60 * 600 * 1000,
  logLevel: 'VERBOSE',    
  redisURL: 'redis://localhost:6379'
});

Environment Setup
Server
parse-server version: 2.4.2

Database
MongoDB version: 3.2.13

@natanrolnik
Copy link
Contributor

Please fill the issue template and we'll reopen

@el-mail
Copy link
Author

el-mail commented Jun 6, 2017

@natanrolnik +1

@natanrolnik natanrolnik reopened this Jun 6, 2017
@el-mail
Copy link
Author

el-mail commented Jun 13, 2017

up
Hey guys
i send manually message, event "create"
... {"op":"create","requestId":1,"object": {"className": "Map", "objectId": "jIh2ewJy86"},"sessionToken":"r:9cavbahxlvpaxvdqylhr8hsecwfvn2py5"}

Server response
{"op":"error","error":"No enum match for: \"create\"","code":1,"reconnect":true}
what this it "Connect message error No enum match for: "create""
why doesn't not eventemitet in Client parse js sdk?
Guys, help me

@THEDOWNCOUNTRY
Copy link

Hello is it possible to get tge client disconnect event on the server side if yes please explain how?

@stale
Copy link

stale bot commented Sep 18, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants