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