Skip to content

Expected HTTP 101 response but was '403 Forbidden' #94

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
memishood opened this issue Jan 20, 2019 · 2 comments
Closed

Expected HTTP 101 response but was '403 Forbidden' #94

memishood opened this issue Jan 20, 2019 · 2 comments

Comments

@memishood
Copy link

memishood commented Jan 20, 2019

I use a remote http parse server (2.8.4 parse server version) - (Google cloud compute engine - windows server 2016) and i created a custom Posts class on Dashboard and i tried LiveQuery for Android, i saved any object to Post class but LiveQuery didn't worked

App class:

`
val configuration = Parse.Configuration.Builder(this)
.applicationId(getString(R.string.parse_server_app_id))
.clientKey(null)
.server(getString(R.string.parse_server_url))
.build()

    Parse.initialize(configuration)

`
manifest application:
name = ".App"

MainActivity:
`
val parseLiveQueryClient: ParseLiveQueryClient = ParseLiveQueryClient.Factory.getClient() // when i tried getClient(URI("ws://185...**:1337/")) it gives Expected HTTP 101 response but was '404 Not Found'
val parseQuery: ParseQuery = ParseQuery.getQuery("Posts")
val subscriptionHandling = parseLiveQueryClient.subscribe(parseQuery)

    subscriptionHandling.handleEvents { query, event, objects ->
        Log.d("onHandleEvents",objects.getString("Message")) // i created two column Message and Sub in Posts class
    }

    subscriptionHandling.handleError { _, exception ->
        Log.d("onError",exception.localizedMessage)
    }

Handler().postDelayed(Runnable {
Log.d(this.tag,"Started push")
val pObject = ParseObject.create("Posts")
pObject.put("Sub","Hello")
pObject.put("Message","There!")
pObject.saveInBackground()
},5000)
Server side:
var api = new ParseServer({
databaseURI: databaseUri || 'mongodb://,
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: process.env.APP_ID || 'tjlF
',
masterKey: process.env.MASTER_KEY || 'fg
*',
serverURL: process.env.SERVER_URL || 'http://localhost:1337/parse',
liveQuery: {
classNames: ['Posts', 'Comments'] // List of classes to support for query subscriptions
}
});
var httpServer = require('http').createServer(app);
httpServer.listen(port, function() {
console.log('parse-server-example running on port ' + port + '.');
});
ParseServer.createLiveQueryServer(httpServer);
`

it gives Expected HTTP 101 response but was '403 Forbidden' for response when i tried LiveQuery, anyone can help me ?

@memishood memishood reopened this Jan 21, 2019
@memishood memishood changed the title ParseLiveQuery doesn't generate response Expected HTTP 101 response but was '403 Forbidden' Jan 21, 2019
@mmimeault
Copy link
Contributor

Did you find the solution?

@memishood
Copy link
Author

Yes, when i run the server i used to npm start so it's generate a new index.js as your config.json keys, i was thinking its same with node index.js, i use node index.js and no problem anymore, thank you

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

2 participants