sailstech / multiple-apps-parse-server

run and manage multiple parse apps (instances) in a server and using a single port
MIT License
55 stars 12 forks source link

Problem with setting up LiveQuery #8

Closed Zalewa4 closed 3 years ago

Zalewa4 commented 3 years ago

Hello guys, i have seen many tutorials how to setup LiveQuey (most of them were prepared for back4app servers) However i found some tutorials made for self hosted servers and there was something like "index.js" which i believe is in this app "app.js". I've put like this code inside of var api = new ParseServer({...

liveQuery: { classNames: ["Test"] //List of classes to support for query subscritions },

and after that i put this:

var app = express();
app.use('/', api);
let httpServer = require('http').createServer(app);
httpServer.listen(1337);
var parseLiveQueryServer = ParseServer.createLiveQueryServer(httpServer);

Still doesn't work and i'm not even sure how this url liveQueryUrl: keyLiveQueryUrl looks like. According to flutter doc's https://pub.dev/packages/parse_server_sdk_flutter i need this to use Live Query.

For example in this parser there's index.js whit pre setup live query https://github.com/parse-community/parse-server-example/blob/master/index.js i've tried to copy some code to my app.js but couldn't handle it.

Zalewa4 commented 3 years ago

So i finally find out the problem. The problem was this port 1337 that i wanted to use was blocked by default. I checked list of free ports, change it to the other port and now I'm connected:

I/flutter (20494): LiveQuery: : Listen: {"op":"connected","clientId":"1437a932-c260-45b8-a567-417127f68efd"} I/flutter (20494): ReSubScription:{} I/flutter (20494): LiveQueryReconnectingController: LiveQueryClientEvent.CONNECTED I/flutter (20494): LiveQuery: : SubscribeMessage: {op: subscribe, requestId: 1, query: {className: Test, where: {intNumber: 1}}} I/flutter (20494): LiveQuery: : Listen: {"op":"subscribed","clientId":"1437a932-c260-45b8-a567-417127f68efd","requestId":1}