Description
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:
`const app = express(); `
`app.use(
'/parse',
new ParseServer({
databaseURI: DATABASE_URI,
cloud: path.resolve(__dirname, 'cloud.js'),
appId: APP_ID,
masterKey: MASTER_KEY,
fileKey: 'FILE_KEY',
serverURL: "https://${SERVER_HOST}:${SERVER_PORT}/parse",
liveQuery: {
classNames: ['Class', 'AnotherClass'],
}
})
);
let httpServer = require('http').createServer(app);
httpServer.listen(SERVER_PORT, () => {
console.log("parse server running on port ${SERVER_PORT}")
});`
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...
`let query = new Parse.Query('Class');`
`query.equalTo("username", "[email protected]");
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
})`
{
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
- Server
- parse-server version (Be specific! Don't say 'latest'.) : 2.2.22
- Operating System: MacOS Sierra
- Hardware: MacBook Pro
- Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): [FILL THIS OUT]
- Database
- MongoDB version: 3.2.7
- Localhost or remote server? I am running Parse Server on an AWS EC2 instance with mLab. However, I have been unsuccessful when using the EC2 url and localhost as the server url.