In this example you connect to Meteor with code like this
Meteor.connect('ws://192.168.X.X:3000/websocket');//do this only once
This is an asynchronous method and, as result, it returns nothing and it also doesn't accept a callback and Meteor.status()
right after it will return connected == false
. So the only solution I can see is to wrap this check into setTimeout
callback with timeout set to, say 5s. Then, in case Meteor.status().connected
is still false
to show an error in UI. Is there a better solution?