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

Not working on webkit #1

Open
AlbertoElias opened this issue May 30, 2012 · 11 comments
Open

Not working on webkit #1

AlbertoElias opened this issue May 30, 2012 · 11 comments
Assignees

Comments

@AlbertoElias
Copy link

Hi,

I've been trying to get an app working with atomize, but I couldn't manage to get it working. The instance that needs to send information does send it, but the rest of the instances don't receive said information. I have tried it on chrome and on Webkit with Qt. I also tried all the demos on the AtomizeJS get started page and the bomberman example and it didn't work either. I did try it on Firefox and it worked as it should. Am I doing anything wrong or is there any kind of problem?

@AlbertoElias
Copy link
Author

I saw your last commit about compatibility issues and update to 0.0.16, but it still isn't working on webkit :S I'm also getting an error in compat.js:

TypeError: 'undefined' is not a function (near '...}).bind(Object);...') in line 55.

@msackman
Copy link
Member

msackman commented Jun 6, 2012

Hi Alberto.

Sorry, for some reason this didn't pop up in my notifications - hence the delay in replying.

The compatibility issues are due to needing JavaScript Proxies.

  • Recent Firefoxes just have Proxies turned on by default so they will work without the translation tool
  • Chrome has Proxies built in, but you need to launch chrome with --js-flags="--harmony" to enable them
  • If you don't want to start Chrome with Proxies enabled or for any other browser, you'll need to use the translation tool to prepare versions of your JS that don't need Proxies http://atomizejs.github.com/translate.html

Internet Explorer currently has a daft security setting which seems to prevent it running JS if the mime-type of the file is set to text/plain which is what github does on raw URLs. I'll do some testing this afternoon and see what I can do.

Please let me know how you get on or if any of this is unclear.

@msackman
Copy link
Member

msackman commented Jun 6, 2012

Ok, I found some bugs. With 0.0.18 I can make eg bomberman work in IE, Safari, Chrome and FF with and without: a) the browser's harmony extensions; b) node's harmony extensions.

Please let me know how you get on.

@ghost ghost assigned msackman Jun 6, 2012
@AlbertoElias
Copy link
Author

Thanks for replying! I thought about the translation problem, but I couldn't find how to use the tool. It doesn't come with atomize-client, nor can I npm install it directly. And I don't really understand correctly when to use said tool. Right now, an app done using atomize without this tool, on which browsers with default settings would it run on? And with the tool?

I'll check soon to see if with the new upgrades it's working for me. Thanks a lot!

@msackman
Copy link
Member

msackman commented Jun 7, 2012

The translation tool does come with the client. If you npm install atomize-client then you should find node_modules/.bin/atomize-translate. If not, please let me know - I might be doing something wrong with the package.json.

The documentation is probably not very clear, but essentially, it should be fine to use it very plainly

atomize-translate inputFile outputFile atomizeVar

should be enough to get started.

However, if you want to avoid using the translation tool then just using an up to date firefox would be fine, or use chrome, but you have to start chrome with some command line arguments, specifically, --js-flags="--harmony"

Let me know how you get on.

@AlbertoElias
Copy link
Author

Hi, sorry for the long delay, I've been travelling quite a lot and working on other stuff, but I'm finally able to continue with this.

I update everything atomize related to the latest version but I'm getting an error on atomize.js saying that undefined is not a function when evaluation this line:

            dest[fields[i]] = src[fields[i]].bind(src);

atomize.js:122TypeError: 'undefined' is not a function (evaluating 'src[fields[i]].bind(src)')

It's line 122 in the result.lift function and I'm running webkit on Qt. And on my js file that uses atomize, the atomize variable is established as undefined. I used the translation tool and tried the translated file and I got another error on the console.log that tells me that the atomize variable is undefined.

Thanks a lot!

@msackman
Copy link
Member

Ok, a recent webkit should be fine, but could you check that your JS environment supports 'bind' please? I'm pretty sure it's a standard ECMAScript 5 feature. If it's not there there are various shim libraries that can sometimes be used to work around missing features.

One other possible cause that I've seen with, eg IE, is that you sometimes have to convince the browser that your HTML etc is version 4 strict or better to convince the JS engine to turn on certain features. I don't know whether you can find out how your browser is interpreting the page.

Have you been able to get any of the basic tutorials or "hello-world"-style examples to work in your environment? I'd certainly suggest starting there if you've not already.

Best wishes.

@AlbertoElias
Copy link
Author

So, I've been checking a few things out. First, I think the atomize-server for the bomberman example isn't compatible with Express 3, I don't think this fix will be too big. I've been trying out your examples (http://atomizejs.github.com/getting_started.html) on both Firefox and Chrome and found another quick fix. In your website, in the first client example you have this line:

atomize.root.x = Date.toString();

Should be changed to something like:

atomize.root.x = (new Date()).toString();

So, these examples are working perfectly on Firefox, but still not on Chrome. In Firefox I get the Wrote, Read when it should, while on Chrome it's always Wrote. I suppose it's because I haven't used the translation tool, but I can't find the binary neither.

Update: Just tried to execute Chrome with Harmony and it worked, so yeah, I need to make use of the translation tool but I can't find it.

Update 2: I managed to get the Bomberman example working with Express 3, very few changes to be made:

var app = express();
var http = require('http');

var server = http.createServer(app);
var atomizeServer = atomize.create(server, '[/]atomize');

And this IS working in Chrome withouth Harmony using bomberman-compat.js so I guess that all I need is the translation tool and finish getting the hang out of atomize :)

Cheers

@msackman
Copy link
Member

Hi Alberto. Thanks for digging in to this. I've made the changes to the Date example. I'll work through the changes to the app.js for Express 3 as soon as I get a chance.

It's very odd that you're not finding the translation tool.

If you just do an npm install atomize-client, you should then find the atomize-client folder in a node_modules folder either in your current directory, or some parent. In that very same node_modules folder, there should be a .bin folder (note the leading .) which contains the atomize-translate script.

Or, a locate atomize-translate command should show you where it is - though I don't know what platform you're on so it may not have locate.

@msackman
Copy link
Member

Yup, I've also incorporated the express3 changes. I also spotted in -server that I was referencing a very old version of sockjs, so I've bumped that too. Do let me know how you get on.

@AlbertoElias
Copy link
Author

I hadn't checked in that .bin folder, but I just did and I don't even have that folder. I also searched atomize-translate and it's nowhere to be found =/

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