I’ve just started do develop user interfaces for OpenHybrid and I’m wondering why the objectIO.js file is not included by default in an object’s folder like index.html or object.js are. Is there a reason for that? If not I would suggest to create this file by default for every Hybrid object. Or we could just add it’s content to object.js.
I think the best would be to add it to object.js.
There are some error messages that come up when you include objectIO.js without having it speak to a socket.io server. This might have been the reason to separate it (I don’t remember).
Yes it generates those errors. Maybe we could catch them? So that when you’re testing the UI locally and there is no connection nothing happens.
I added the objectIO.js in to the object.js with the latest commit.
If socket.io is not available the constructor returns empty functions for preventing errors.
I needed to add
to the html page.
I tried many things to load /socket.io/socket.io.js via
This would allow to include the script call in to object.js as well.
But it is not ready at the time the script is evaluated.
We could do it with a call back, but then the entire webpage code would need to be encapsulated in to the callback.
Do you have any idea?
Ok I found a solution. (latest commit)
I could load socket.io.js synchronous via XMLHttpRequest.
Now you only need to reference object.js in the html page.
If you load the webpage offline, your code will execute, but with a console message that socket.io is not loaded.