Skip to content
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

Connecting to meteor server using ROOT_URL #91

Open
lpanger opened this issue Nov 21, 2016 · 1 comment
Open

Connecting to meteor server using ROOT_URL #91

lpanger opened this issue Nov 21, 2016 · 1 comment
Labels

Comments

@lpanger
Copy link

lpanger commented Nov 21, 2016

I have a local meteor instance running with the ROOT_URL set to http://localhost:3000/admin/. I can't seem to figure out the correct settings the DDP client should be set for this to work. Everything works when I remove the ROOT_URL environment variable.

var ddpClient = new DDP({
  host: 'localhost',
  port: 3000,
  //url: 'wss://localhost:3000/admin/websocket',
  //useSockJs: true,
  //ddpVersion: '1'
});

ddpClient.connect(function(error, wasReconnect) {
  if (error) {
    console.log('DDP connection error!');
    return;
  }

  console.log('connected!');
})

The commented out properties are different things I've tried without any success. What am I missing here? Note that I will be using the cluster package in the future so SockJS is required.

@vsivsi
Copy link
Member

vsivsi commented Dec 2, 2016

Per the example in the README:

  // uses the SockJs protocol to create the connection
  // this still uses websockets, but allows to get the benefits
  // from projects like meteorhacks:cluster
  // (for load balancing and service discovery)
  // do not use `path` option when you are using useSockJs
  useSockJs: true,
  // Use a full url instead of a set of `host`, `port` and `ssl`
  // do not set `useSockJs` option if `url` is used
  url: 'wss://example.com/websocket'

It seems that using SocksJS is not compatible with specifying a custom ROOT_URL. I'm not sure if that is a limitation of node-ddp-client or SocksJS. If it turns out to be the former, I would be happy to merge a PR forthis package that fixes the issue.

@vsivsi vsivsi added the question label Dec 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants