3

I am trying to connect my Ionic App to a Meteor App, using DDP (i tried using both Mondora's DDP.JS and Mondora's Asteroid solutions, but they both give me the same error)

  // Connect to a Meteor backend
  var options = {
      endpoint: "ws://my.meteor.app/websocket",
      SocketConstructor: WebSocket
  };
  var ddp = new DDP(options);

  ddp.on("connected", function () {
      alert("Connected");
  });
  ddp.on("disconnected", function () {
      alert("Disconnected");
  });

The thing is, when i run it on the chrome emulator (Ionic Serve) it works flawlessly, but when i run on the android phone (Ionic Run), it always gives me this error.

WebSocket connection to 'ws://my.meteor.app/websocket' failed: Error during WebSocket handshake: Status line does not end with CRLF

I have seen a question similar to this here on Stack, but i can't find the error on the DDP.JS file, it doesn't explicitly show me the Headers

I think the error is a bit misleading. Every header should end with CRLF and not only the first one (the 'status line'), it seems. At least according to the test case. (PhistucK on Websocket communication between chrome(client) and hotspot(server) (Status line does not end with CRLF)).

I have tried adding this '\r' thing on almost every variable on the DDP.JS file, with no success. Does anyone know what's happenning?

Thanks in advance,

Bruno

Community
  • 1
  • 1
Bruno Duarte Brito
  • 130
  • 1
  • 2
  • 10
  • If you haven't given up, then try using WireShark (https://www.wireshark.org/) to get more information on what exactly is happening. It may be that you're sending different request headers that somehow makes Meteor behave differently on its response. That's speculation, but WireShark would help you find out if that's the case. – Jay May 21 '15 at 15:14
  • Me too getting the same error.Were You able to design? – Ankita Nov 04 '15 at 12:32

0 Answers0