Code Monkey home page Code Monkey logo

enhanced_meteorify's People

Contributors

ruerob avatar shivamarora avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

enhanced_meteorify's Issues

dynamic IP address for Meteor.connect();

hi, do you have any Example App of make dynamic ip address for meteor connection , what i'm doing right now i have text field for user input their ip address and then i store it with shared_preferences so i get it later to use with Meteor.connect(); and reconnect to meteor and i also need to listen to connection
await Meteor.connect('ws://$_ipAddress/websocket');

Question: re-subscribe same name with different arguments

Technically, what happens when one of these reactive sources changes is the following:

  1. The reactive data source invalidates the autorun computation (marks it so that it re-runs in the next Tracker flush cycle).
  2. The subscription detects this, and given that anything is possible in next computation run, marks itself for destruction.
  3. The computation re-runs, with .subscribe() being re-called either with the same or different arguments.
  4. If the subscription is run with the same arguments then the “new” subscription discovers the old “marked for destruction” subscription that’s sitting around, with the same data already ready, and reuses that.
  5. If the subscription is run with different arguments, then a new subscription is created, which connects to the publication on the server.
  6. At the end of the flush cycle (i.e. after the computation is done re-running), the old subscription checks to see if it was re-used, and if not, sends a message to the server to tell the server to shut it down.

Step 4 above is an important detail—that the system cleverly knows not to re-subscribe if the autorun re-runs and subscribes with the exact same arguments. This holds true even if the new subscription is set up somewhere else in the template hierarchy. For example, if a user navigates between two pages that both subscribe to the exact same subscription, the same mechanism will kick in and no unnecessary subscribing will happen.

Does the package implements this mechanism?

When I re-subscribe same name with different arguments which one is better performance? unsubscribe first or just resubscribe?

Thanks

Automatic reconnect after Meteor.disconnect()

Hello @wendellrocha!

I've got a small problem here. I have a disconnect button in my app. That should disconnect the app from the server until the user wants to reconnect.
The disconnect seems to work at first. But then I get a message into my logging:

I/flutter ( 6904): [DDP] <- :: {"msg":"ping"}
I/flutter ( 6904): [DDP] -> :: {"msg":"pong"}
I/flutter ( 6904): [DDP] <- :: {"msg":"ping"}
I/flutter ( 6904): [DDP] :: Disconnect due to websocket onDone
I/flutter ( 6904): [DDP] :: Disconnected code: null, reason: null
I/flutter ( 6904): [DDP] :: Schedule reconnect due to websocket onDone

And after some more seconds and ping pongs, the app reconnects to the server.

I tested the disconnect in a new dart project. I just called the following function before building the first view:

  static _connect() async{
    await Meteor.connect("ws://bladereport-dev.rc-srv.de/websocket");

    Meteor.disconnect();
  }

I already tried to locate the problem but wasn't able to make a pull request for now.

I hope this issue helps you.

Have a great day
Robert

Meteor.subscribe does not throw error if there was an error.

Hello,
The Meteor.subscribe() method does not throw any error if there are are any errors coming from the Meteor server. Is there something I'm missing? Please help.

Thank you.

Here is my Flutter code:

try {
  await Meteor.connect('ws://localhost:3000/websocket');
  users = await Meteor.collection('users');
  users!.addUpdateListener((collection, operation, id, doc) {
    print('listener.....');
    print(collection);
    print(operation);
    print(id);
    print(doc);
    print('listener.....');
  });
  String? subId = await Meteor.subscribe('loginUser', args: ['user1', 'password']);
  print("sub id is: $subId");
} catch (error) {
  print(error);  // <---- this doesn't print
}

Here is my Meteor code:

Meteor.publish('loginUser', function (username, password) {
  console.log('user has subscribed...');

  this.error(new Meteor.Error(new Error('does this work?')));

  return UsersCollection.find({ username });
});

This is the terminal output.

[DDP] -> :: {"msg":"connect","version":"1","support":["1","pre2","pre1"],"session":""}
[DDP] <- :: {"msg":"connected","session":"MiWdXhtT8W979sLd9"}
[DDP] -> :: {"msg":"sub","name":"loginUser","params":["user1","yet"],"id":"loginUser-0"}
[DDP] <- :: {"msg":"nosub","id":"loginUser-0","error":{"isClientSafe":true,"error":{},"message":"[Error: does this
work?]","errorType":"Meteor.Error"}}

Call method when network connection is lost.

When the network connection is lost, calling a method, what will happen?in my experiment
it will deadlock here.If so, how to avoid that?

try{
var result = await Meteor.call('hello',[{'firstname':'Wendell','lastname':'Rocha'}]);
print(result);
}catch(error){
print(error);
}

When will the loginWithToken function throw an exception?

When will the loginWithToken function throw an exception?

I log out the user based on the two conditions that this function returns null and throws an exception. I have set the token on the server side to never expire, and there will be occasional inexplicable logouts.

server side code

Accounts.config({
loginExpirationInDays: null
});

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.