wendellrocha / enhanced_meteorify Goto Github PK
View Code? Open in Web Editor NEWThis project forked from shivamarora/meteorify
A dart package for interacting with Meteor
License: BSD 2-Clause "Simplified" License
This project forked from shivamarora/meteorify
A dart package for interacting with Meteor
License: BSD 2-Clause "Simplified" License
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');
Technically, what happens when one of these reactive sources changes is the following:
- The reactive data source invalidates the autorun computation (marks it so that it re-runs in the next Tracker flush cycle).
- The subscription detects this, and given that anything is possible in next computation run, marks itself for destruction.
- The computation re-runs, with .subscribe() being re-called either with the same or different arguments.
- 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.
- If the subscription is run with different arguments, then a new subscription is created, which connects to the publication on the server.
- 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
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
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"}}
I tried using few methods like Accounts.changePassword, Accounts.createUser with return type String, they all throw this exception:
Unhandled Exception: type 'Future' is not a subtype of type 'String' in type cast
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);
}
hi , how can i disable debug ?
er
can't find userAsMap in code but document.
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
});
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.