1

I'm trying to connect via DDP to my meteor-deployed website at http://testsock.meteor.com . This other answer has been very helpful, but I'm having trouble finding what my URL is, which according to that answer should have the following structure:

ws://ddp--xxxx-{host name}.meteor.com

How do you find out?

My meteor.js file is:

if (Meteor.isClient) {
    }

    if (Meteor.isServer) {
      Meteor.startup(function () {
        // code to run on server at startup
      });

      Meteor.methods({
        test: function(){
          return 5;
        }
      });
    }

I'm using pyddp, and my python file to ddp into mywebsite is:

    import ddp
    import time
    import sys

    client = ddp.ConcurrentDDPClient('wss://testsock.meteor.com:443/websocket')
    client.start()

    while True:
        try:
            time.sleep(1)
            future = client.call('test')
            result_message = future.get()
            if result_message.has_result():
                print 'Result:', result_message.result
            if result_message.has_error():
                print 'Error:', result_message.error

        except KeyboardInterrupt:
            sys.exit()
            client.stop()
            client.join()
            break
Community
  • 1
  • 1
lyn
  • 75
  • 5
  • I have been connecting to apps deployed on meteor.com using `wss://myapp.meteor.com:443/websocket`. Have you tried it? – MasterAM Nov 12 '15 at 14:24
  • thanks for the reply! but unfortunately "no handlers could be found for logger "asynico"" :( – lyn Nov 13 '15 at 14:23
  • I don't think that it has anything to do with the ddp connection. You should probably share the relevant code that, preferably, makes the issue reproducible. – MasterAM Nov 13 '15 at 14:26
  • Ah yes I just discovered that!! Not sure what's wrong with the code now but upon debugging, i see it can indeed connect via ddp. thanks!! – lyn Nov 13 '15 at 14:30
  • Did you use the URL schema that I specified or some other URL? – MasterAM Nov 13 '15 at 14:31
  • Sorry.. correction! I realize that wss://myapp.meteor.com:443/websocket was indeed not working. I ran the script just websocketing locally (ws://127.0.0.1:3000/websocket) and everything works, but when deployed, i can't websocket in to meteor :( – lyn Nov 13 '15 at 22:22
  • Please share the relevant code. – MasterAM Nov 13 '15 at 22:44
  • I don't know `pyddp`, but I am using [python-meteor](https://github.com/hharnisc/python-meteor) and was able to connect to your test server. – MasterAM Nov 14 '15 at 15:32
  • great, i will try that! thank you very, very much for your help! – lyn Nov 14 '15 at 17:07

1 Answers1

1

When connecting to an app that is deployed to meteor.com, you can use the following URL scheme:

wss://myapp.meteor.com:443/websocket

wss denotes the encrypted WebSocket protocol URI scheme, and it is run on port 443.

MasterAM
  • 16,283
  • 6
  • 45
  • 66