Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

Stream end encountered #29

Closed
Vortec4800 opened this issue Apr 28, 2016 · 9 comments
Closed

Stream end encountered #29

Vortec4800 opened this issue Apr 28, 2016 · 9 comments

Comments

@Vortec4800
Copy link

I'm setting up a Live Query, and it doesn't seem to want to work. I think my server setup is correct:

var api = new ParseServer({
  databaseURI: databaseUri || '',
  cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
  appId: process.env.APP_ID || '',
  masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it secret!
  serverURL: process.env.SERVER_URL || 'https://my.domain.com:1337/parse',  // Don't forget to change to https if needed
  push: {
    ios: [
      {
        pfx: 'keys/PushDev.p12', // Dev PFX or P12
        bundleId: 'com.id',
        production: false // Dev
      }
      // {
      //   pfx: '', // Prod PFX or P12
      //   bundleId: '',  
      //   production: true // Prod
      // }
    ]
  },
  liveQuery: {
    classNames: ["LiveClass"] // List of classes to support for query subscriptions
  }
});

...
...
...

var port = process.env.PORT || 1337;
var httpServer = require('https').createServer({
    key: privateKey,
    cert: certificate
}, app);

httpServer.listen(port, function() {
    console.log('server running on port ' + port + '.');
});

// This will enable the Live Query real-time server
ParseServer.createLiveQueryServer(httpServer);

The only thing that's out of the ordinary is that I'm running with SSL on HTTPS. Does the LiveQuery server require any special setup for SSL?

When I create a live query, the console floods with:

code: 1001 reason: Stream end encountered

When I launch the server, I don't seem to get any error messages or anything and it appears to launch cleanly. What should I check?

@chadpav
Copy link

chadpav commented May 3, 2016

@Vortec4800 I just hit this same error message. I actually have LiveQuery working locally (same ParseServer + LiveQueryServer instance). I also have it working on the same instance in AWS.

I just ran into this error when trying to split out LiveQuery to it's own AWS Application and talking to our existing ParseServer as suggested in the Scalability section of the LiveQuery wiki (note: I'm not using a Redis server yet, just trying to get 1 instance of PS to talk to 1 instance of LQS).

Are you running 1 instance or 2? Are you running locally or in something like AWS?

@Vortec4800
Copy link
Author

I'm just running a single instance on a single server, which is a Digital Ocean server.

I did end up figuring out my issue, I was using SSL for my Parse server, which means the websocket the Live server uses is SSL too, but the iOS client was hard-coded to use ws:// instead of wss:// (which is like https://). Once I changed that, it started working.

I do wish there were better error messages though...

@chadpav
Copy link

chadpav commented May 3, 2016

Thanks for the response. I'm not using SSL yet but I did resolve this issue.

For reasons not relevant here, my LiveQuery Server wasn't even starting. For others coming here, the 1001 stream end encountered error is probably indicating that your client can't reach the server at the URL you gave it whether it's an SSL config problem or your server isn't listening on the address you gave it.

@FredvanRijswijk
Copy link

Did anyone off you have this working client side on iOS Swift ? I can't figure it out...

@chadpav
Copy link

chadpav commented May 31, 2016

@FredvanRijswijk I have LiveQuery working in an iOS Swift app. Do you have a specific question or error message? If it's not related to this issue please open a new one.

@FredvanRijswijk
Copy link

@chadpav Need some support for how to use the data with LiveQuery like in #38 maybe it's me misunderstanding and lack of experience and missing some documentation... ;-(

@chadpav
Copy link

chadpav commented Jul 12, 2016

@FredvanRijswijk it wasn't as straightforward as it should have been. I probably should submit a documentation update if I am able to help you through it.

Do you have a specific question or maybe you should just contact me. I'm at chadpav at the gmail.

@zh-wowtv
Copy link

I got the same problem here. My server code:

server.use(
  '/parse',
  new ParseServer({
    databaseURI: DATABASE_URI,
    cloud: path.resolve(__dirname, 'cloud.js'),
    appId: APP_ID,
    masterKey: MASTER_KEY,
    serverURL: `http://${SERVER_HOST}:${SERVER_PORT}/parse`
    liveQuery: {
      classNames: ['Room','Message']
    }
  })
)

server.listen(SERVER_PORT, () => console.log(
  `Server is now running in ${process.env.NODE_ENV || 'development'} mode on http://localhost:${SERVER_PORT}`
))
ParseServer.createLiveQueryServer(server);

Screenshot when I run the LiveQueryDemo:

1

@protspace
Copy link

protspace commented Jan 13, 2017

have same error. Appeared after I changed to db connection url in parse-server config to:

mongodb://parse:password@your_domain_name:27017/database_name?ssl=true

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

No branches or pull requests

6 participants