Parse-sdk-js: React Native & Live Query

Created on 13 May 2016  路  25Comments  路  Source: parse-community/Parse-SDK-JS

Does using the react native part of the parse js sdk work well with live query? I read that react-native now supports websockets and was wondering if this support carried over to the js sdk. Or would it be more advisable to use the parse live query ios-osx sdk ?

Most helpful comment

I'm currently seeing 'info: Parse LiveQuery Server starts running' after starting the server. However, while I can verify that the subscription with query is created, the console.log statements that I attached to each callback for lifecycle events ('open', 'create'...) do not show up in Chrome. ANy insight on how to make this work?
screen shot 2016-10-10 at 4 52 14 pm

All 25 comments

Looks like v1.8.2 "Fix[ed] React Native support for Live Queries." So it should work.

https://github.com/ParsePlatform/Parse-SDK-JS/releases/tag/v1.8.2

Yes, it should be supported. I didn't develop the LiveQuery features, but I've actively tested them in RN with success.

I'm glad to hear that LiveQueries support react (I'm assuming also react, not only NATIVE right?)

However, I'm having trouble making sense of the documentation:
in ParseReact project, they say:

Parse + React only supports the Parse JS SDK up to version 1.6.14. Behavior with 1.7.* is unpredictable, and 1.8.* breaks functionality with the new LiveQueries feature

When here, in the parse SDK JS, you say that LiveQueries do work.

So, either the first documentation is not updated, or I can use LiveQueries, by using the SDK JS and not the ParseReact lib? Is that right?

edit As I think I understand now, the parse-react functions (observe etc.) are broken, but other non-react JS SDK parse functions work the same on react?
Thanks!

I'm currently seeing 'info: Parse LiveQuery Server starts running' after starting the server. However, while I can verify that the subscription with query is created, the console.log statements that I attached to each callback for lifecycle events ('open', 'create'...) do not show up in Chrome. ANy insight on how to make this work?
screen shot 2016-10-10 at 4 52 14 pm

"parse": "1.9.2", "parse-server": "2.2.12", "react": "15.3.1","react-native": "0.33.0",
Before digging to deep, will Parse Live Query work with these versions?

i do not know why RN cant connect to livequery on ios both on simulator and device. even though querying parse-server is just fine with http or https. android is working fine regardless.

i have tried setting it to ws or wss. also setting the app transport security to NSAllowsArbitraryLoads.

maybe it doesnt play well with nginx

@jjdp Did you manage to resolve this?

if you setup https through node/express it connects. ssl termination through nginx, i cant get livequery to connect

this is a blocker for my ios app, and https through node is not reliable. any solution for nginx ssl termination on livequery?

@pweh is that what you鈥檙e looking for? https://www.nginx.com/blog/websocket-nginx/

@pewh try haproxy, ssl termination with livequery worked for me on IOS though I can't remember the config anymore.

nginx's config file seems fine for me

screen shot 2017-10-07 at 10 15 23 pm

I never touch haproxy before. Because deadline is near, I'll stick to figure out nginx's solution for now

@pweh is it working with that config,

@flovilmart the config file is working and already connecting to android without problem. But on iOS, livequery can't be accessed because of ssl nginx termination issue. But when connect to local server, it's work. Btw, have you face any issue when using livequery (using remote server, nginx ssl termination) on ios?

Interesting, do you have any logs or so from the server, nginx etc.. does the connection reach the server or not?

This is what I've done on production server:
I have restart server and when my Android app is open, the log show that Current client number: 1. When I kill Android app, it show disconnect log.

For iOS case, I restart the server first & clear the logs, when my iOS app is open, the log show that Current client number: 0. When I kill iOS app, no disconnect log.

Both platform show Parse Cloud Code logs, so I think iOS' issue is only on livequery.

Do you have some log on the iOS side? Also if you use nginx without TLS termination, does live query work correctly?

@jjdp can nginx & haproxy work together? I mean, nginx do everything except ssl termination, and let haproxy handle ssl termination

@flovilmart it's work when I use nginx without TLS termination. I've not capture logs when use TLS but I'll post it later

sure you can, it really depends on your architecture and your understanding of it

I have compare logs between TLS & non-TLS on iOS app, and everything is same except on TLS, there are log say 2 libnetwork.dylib 0x0000000115513555 nw_endpoint_flow_attach_pro2017-10-09 00:37:52.459 [info][tid:com.facebook.react.WebSocketModuleQueue][RCTSRWebSocket.m:520] SocketRocket: In debug mode. Allowing connection to any root cert tocols + 3768

Chrome JS console printed SocketRocket: In debug mode. Allowing connection to any root cert every time it tries to subscribe livequery on TLS nginx. But when subscribe to non-TLS nginx, there's no warning.

When @jjdp subscribe livequery with haproxy ssl termination, have you see SocketRocket: In debug mode. Allowing connection to any root cert on JS console when debug iOS app?

That applies to all websocket connections. Is ssl termination really needed in your case? Why not just serve parse server through https?

Yes, ssl termination is really needed because data traffic contains sensitive profile.

Did you mean configure https on node/express app? NodeJS TLS itself is not so reliable for many concurrent connection.

And I've read some best practice for Parse Server (I don't remember the source) to always use reverse proxy for security concern

Was this page helpful?
0 / 5 - 0 ratings

Related issues

simpleshadow picture simpleshadow  路  6Comments

lamualfa picture lamualfa  路  5Comments

ryanemax picture ryanemax  路  7Comments

dylankbuckley picture dylankbuckley  路  4Comments

Jonarod picture Jonarod  路  6Comments