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

IOS receiving json with parentheses !!! #61

Closed
kefahB opened this issue Jun 21, 2018 · 3 comments
Closed

IOS receiving json with parentheses !!! #61

kefahB opened this issue Jun 21, 2018 · 3 comments

Comments

@kefahB
Copy link

kefahB commented Jun 21, 2018

Did you verify this is a real problem by searching the NativeScript Forum and the other open issues in this repo?

YES

Tell us about the problem

Please, ensure your title is less than 63 characters long and starts with a capital
letter.

I use socio.io Server and when i emit event from server i recive :

(
{
"auth_id" = 687019;
}
)

no problem with android i receive :

{
"auth_id" = 687019;
}

Which platform(s) does your issue occur on?

iOS

Please provide the following version numbers that your issue occurs with:

  • CLI: 4.1.0
  • Cross-platform modules: "tns-core-modules": "^4.1.0",
  • Runtime(s):
    "tns-android": {
    "version": "4.1.3"
    },
    "tns-ios": {
    "version": "4.1.1"
    }
  • Plugin(s): (look for the version number in the package.json file of your
    project)
//server.js
const http = require("http");
const server = http.createServer();
const io = require("socket.io")(server);

io.on("connect", (socket) => {
socket.emit("auth_id", {auth_id: 123});
});

//IOS
socketIO.on("auth_id", (data) => {
        console.log("AUTHORISATION ID :");
        console.log(data);
        //output
(
{
"auth_id" = 123;
}
)

Thnk you :)

@kefahB
Copy link
Author

kefahB commented Jun 21, 2018

@jogboms Have you idea about this ? @triniwiz is not active

@kefahB
Copy link
Author

kefahB commented Jun 21, 2018

I add deserialize(), is not a solution but I need to continu to work until we have a real soulution

// nodes-modules/nativescript-socketio/socketio.ios.d.js
SocketIO.prototype.on = function (event, callback) {
        this.socket.onCallback(event, function (data, ack) {
            data = deserialize(data); // HERE I RECEIVE [{msg: "HELLOE}] and I can use it
            if (ack) {
                callback(data[0], ack);
            }
            else {
                callback(data[0]);
            }
        });
    };

@jogboms
Copy link
Contributor

jogboms commented Jun 22, 2018

Sorry @kefahB, i'm a bit swamped with office work lately.

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

No branches or pull requests

2 participants