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

Can't work with my nodejs project #198

Open
phukhanhlee opened this issue May 30, 2019 · 3 comments
Open

Can't work with my nodejs project #198

phukhanhlee opened this issue May 30, 2019 · 3 comments

Comments

@phukhanhlee
Copy link

phukhanhlee commented May 30, 2019

My node js is simply to web socket relay kit. It works well on terminal but It crash when runing on iOS device. I build success with your demo project and I just put my node project on "nodejs-project" folder and run my project.

Here is the crash ! It seem NodeMobile doesn't support "... operator" in javascript ?

send(data, options, cb) {
if (this.readyState === WebSocket.CONNECTING) {
throw new Error('WebSocket is not open: readyState 0 (CONNECTING)');
}

if (typeof options === 'function') {
  cb = options;
  options = {};
}

if (typeof data === 'number') data = data.toString();

if (this.readyState !== WebSocket.OPEN) {
  sendAfterClose(this, data, cb);
  return;
}

const opts = {
  binary: typeof data !== 'string',
  mask: !this._isServer,
  compress: true,
  fin: true,
  ...options ->///////// error here ///////////////
};

if (!this._extensions[PerMessageDeflate.extensionName]) {
  opts.compress = false;
}

this._sender.send(data || EMPTY_BUFFER, opts, cb);

}

Screen Shot 2019-05-30 at 5 43 53 PM

@phukhanhlee
Copy link
Author

After I replace ... operator with function :

function extendObj(obj, src) {
for (var key in src) {
if (src.hasOwnProperty(key)) obj[key] = src[key];
}
return obj;
}

Seem this library doesn't support new javascript style.
I don't master JS but (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax)
is quite used a lot in JS

@jaimecbernardo
Copy link
Member

Hi @phukhanhlee ,

For iOS, nodejs-mobile uses ChakraCore, which seems to not have full support for the spread operator yet: nodejs#620

@FrankFundel
Copy link

Will this be added anytime soon?

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

No branches or pull requests

3 participants