and it works good in web but… (always there is a but)
I have a small problem with connection.
If I have the window of the page and it render during connecting It take too long to estabilish the connection.
If I hide the browser in the task toolbar then it is connecting fast. I do not know the reason.
Do anyone can help to solve this problem ?
I try to found a way to not render the page before the connect complete.
Do any of you out there can help me?
You shouldn’t be using $(function()) its a jquery thing that isn’t suitable for meteor. Meteor.onConnection(callback) should work better maybe. Try this first.
Secondly, meteor has inbuilt connection handling. I’ve never had to call Meteor.reconnect() unless my actual server went down and came back. I’d say remove those.
Its super hard to workout what you are trying to do here it looks like you are trying to make a game. A meteor connection should be instant. My only guess is that your three.js code is blocking too much and interrupting connections. Could you try removing any of the intensive THREE.JS stuff and seeing if the code works.
Hi ahref. Thank you for your respond.
I try to make a connection prototype for a multiuser game with three.js.
Now I have upload in multiuser-prototype.meteor.com this kind of code:
Can i use a script block in the html meteor page? What If i put the three.js code there?
My goal is to start the page rendering after the connection have estabilished.
tip: see the console logs for better understanding.
When you open the multiuser-prototype.meteor.com page you connect in the apps server.
You get a guest name a color and an id.
When a new user connecting you should see him in your screen as a cube with a color.
You can open several pages. Every page is an unique user. Every frame is a unique user.
You can have in page several frames. So in one page you can watch 1x, 2x, 3x, 4x or 6x users.
This way you test if it is real-time (or almost real time). Use the 1x, 2x, 3x, 4x and 6x links on left bottom of the page.
Focus the frames with tab key.
Actualy you focus the links that are focus the frame.
Key Q freeze/unfreeze camera postition.
Key 1 show/hide the on screen console. (Works when user is in “connected” mode. In “connecting” mode the console is appearing automatic and you can not hide it.)
tip: for faster connection, hide your browser in task bar. Open the resourse monitor and watch the network activity. When activity get low then you are connected stable. Return to page.
Meteor.onConnection(callback) is server side yes whoops, ignore me in regards to this.
Stop using
$(function(){
});
Its not needed.
As I said previously I think that your rendering logic in THREE.js is blocking meteor from maintaining a connection. This is why when you can’t see the window it connects faster.
You need to optimize the three code so that it does not block meteor.
Without seeing all of your code its impossible to tell why you are having connection troubles. As far as i can tell you are still doing really weird stuff with connection handling that just isn’t needed.
In particular your app polls the server’s info.json multiple times before establishing a connection. Any other app including the examples do not do this.
I can’t figure out why without seeing your application source a github link or something similar would be needed.
what kind of connection you expect? In my prototypes I always expect all connections to be ready in Meteor.startup part.
And with fastrender package user is already logged in.