Comments (14)
Id suggest this for the moment, it's a little naive because I know some things will be implemented as Futures, but here is the main idea:
Server
Cargo posts = new Cargo("posts", **conf info**);
Cargo users = new Cargo("users", **conf info**);
posts.publish ((Map request, User|Sender sender)
{
if (sender.is (/*some filtering here*/))
return posts.find(request).filter (/*send a subset of the data*/).
...
})
//Maybe also like this
@Publish ('posts')
filterClientPosts (Map request, User|Sender sender)
{
if (sender.is (/*some filtering here*/))
return posts.find(request).filter (/*send a subset of the data*/).
...
}
Client
ClientCargo posts = new ClientCargo("posts", {topic: "DB API"}); //Send with request
ClientCargo users = new ClientCargo("users"); //All users
posts.onChange (...);
posts.onError(...);
Client stuff should try to register with Angular so that any changes also update the angular templates.
from dart-force.
That is a great first start. I guess we need to come up with a use case, for example a realtime blog, redit, ... so we can build this example with the new db client api! Probably I need to twist the proposal of you a bit, but it is already a great starting point!
from dart-force.
Yeah, make the proposal realistic, I am just giving ideas. Meteor's classic examples include: a real time poll, chat, simple social network, Google map with real time gps position of events. I guess the poll is the easiest, you just voted for something in list, each item has a counter, set the getter and setter an angular model to interact with the client-side DB... magic :)
from dart-force.
I crearted an angular force example application in this github repo.
https://github.com/jorishermans/angular-force-example
It is a start ;-)
from dart-force.
Could you explain to me this peace of code?
// Construct page
fs.server.on("/", (req, model) {
return "angularforce";
});
It looks like a basic REST request serving a page, and you don't use sender.send
. What is going on here?
from dart-force.
Yes, this is to handle a page, under the hood it is using ForceMVC it return a viewname, in our case "angularforce" page, I prefer users to use this then using starPage: in the constructor ForceServer.
But you are right it is to confusing.
I am a beginner with angular.dart so if you can improve my angular code, that would be nice!
from dart-force.
I also like this API better to serve the start page, but how do you tell when you are using MVC to serve stuff or normal WebSocket messaging?
from dart-force.
I am also new to angular and Dart in general. I'll run your example as soon as I have the time.
from dart-force.
forceServer.server.on(... // HTTP Requests => will become forceServer.server.use(...
forceServer.on(... // WebSocket messaging
But we need to take this discussion out of this conversation. I added some cargo functionality to the example. So from that point we can look at how we can simplify all of the functionality into a better and simpler api.
from dart-force.
Can you point me to the cargo part in the example? I just checked but I don't see it.
Is Cargo already running on the client?!?!? If you give me some basic info on how to use it I can start making suggestions.
from dart-force.
No cargo is for the moment only on the server! I just did a commit! I think we need to work in steps ;-)
from dart-force.
Ok. I'll check.
from dart-force.
You can view and look at the implementation of the experimental branch of dart force here.
https://github.com/jorishermans/aproducthuntdart
It is a product hunt example that makes it possible to add and update the records.
Would be great if we could get some feedback on this!
from dart-force.
Version 0.6.0 is been released with the clientside db api, you can look at this video to see more info about clientside DB api https://www.youtube.com/watch?v=MtrZLLzPT74
or look at our examples
https://github.com/ForceExamples/aproducthuntdart
or a simpler version of it
https://github.com/ForceExamples/asimplehuntdart
from dart-force.
Related Issues (20)
- Routing HOT 5
- Can we use typed methods for events? HOT 2
- More toolable way to handle connecting? HOT 3
- Unable to run on windows HOT 2
- Get it working in IE9 HOT 1
- can I use dart-force to do server push,how ? HOT 4
- Providing an offline strategy HOT 4
- Connect 2 server together HOT 20
- Use its own custom HttpServer for ForceServer is planned ? HOT 3
- Raw value in ServerSocketConnector HOT 1
- Serve files from '/web' directory without having to build. HOT 1
- provide a reply method in Sender HOT 1
- Enable annotations in ForceClient
- GAE Integration HOT 3
- Cant Start Force With GAE HOT 23
- Sending Files HOT 2
- Implementing ping/pong protocol HOT 3
- Jasmine engine support HOT 2
- Encrypted sockets. HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dart-force.