RealTime web app with PouchDB - javascript

I am writing a real time web app with pouchdb. I am currently using vanilla pouchdb on top of backbone.
That being said, I have been running into quite a bit of conflicts and was wondering if you have any suggestions as to how to handle pouchdb conflicts in the context of a real time web app?
Also, I've noticed this plugin:
https://github.com/redgeoff/delta-pouch. How would this plugin assist with real time web apps?

delta-pouch will give you a setup where there are no conflicts at all, as long as you can express every change as a delta (i.e. a change that is not dependent on a previous state, such as a transaction to a bank account that adds $50).
You can also use this project to assist in resolving conflicts: https://github.com/jo/pouch-resolve-conflicts Or read the guide to conflicts: http://pouchdb.com/guides/conflicts.html

Related

What are the best tools to make an online card game?

I'm looking for some event/reactive online tools to make a card game in a browser.
I think JS is most appropriate here but I'm open to all propositions.
I already tried VueJS / Node with Socket.IO but I think it's very messy and not organized enough to make a project like this. So I was wondering if you guys knew some frameworks to make the job.
The projects is to make an online card game like poker.
Thanks !
You could try pixi.js or phaser 3+.
Also I've wright one of my card-games only using html+css+javascript.
For back-end you could use whatever you want. NodeJS + websockets is good choice!
If the main matter is the realtime database connection (for which you are looking for websockets), you could create the game and store it's data to firebase firestore, this way you could get everything synced in real time with a less pain than a node server setup, (for this purpose), if you need some backend functionality you could also work with firebase functions in order to achieve some backend stuff, also you could even store your project on firebase hosting, have an authentication ready platform with firebase auth and depending on your needs you would not even pay a penny (this really depends on the usage)
Hope this could at least be an option to consider.
Check the firebase documentation: FIREBASE
Even if you wish to work with Unity instead of VueJS you can also use firebase for all this matters.

How to create self updating Node.js application with GitHub Actions

I have Node.js service running on different computers and need to make this service self-updating, with opportunity to schedule different time for update for each computer. I tried to use GitHub Actions, it has on.schedule option for triggering, but the time that I can set here is constant.
Is it possible to change this time dynamically?
If you know some tools for self-updating Node.js application, please recommend them.
Thanks for help.

Detailed explanation on how React Native softwares are updated

I am developing a React Native application. it's a framework to build mobile applications with JavaScript and deploy for Android & iOS with the same code base.
I read somewhere that RN applications are dynamically updated. It means, without releasing new versions to AppStore or GoogleStore, we can update it. It is awesome!
But my question is: how can we do so? I searched a bit and found out that it is possible with Codepush. If so, how? Is it a free tool or we should pay for it? If it's not free, Isn't there a free solution to this?
Also, by updating dynamically, are we limited to update only JS bundle or we are able to update external assets like new fonts, images, and etc?
I would be thankful if an expert guides me by details and workarounds.
Cheers.
Like it explains in CodePush website;
CodePush is a cloud service that enables Cordova and React Native
developers to deploy mobile app updates directly to their users’
devices. It works by acting as a central repository that developers
can publish certain updates to (e.g. JS, HTML, CSS and image changes),
and that apps can query for updates from (using our provided client
SDKs). This allows you to have a more deterministic and direct
engagement model with your end-users, while addressing bugs and/or
adding small features that don’t require you to re-build a binary
and/or re-distribute it through any public app stores.
This means you can update your Javascript code remotely without submitting your app through App Store or Google Play.
This service is currently completely free and you can use it in your app without paying any fees. There are also couple of more systems that are payed or free but I have never used them so I can't say anything about them.
This service does not let you change or update any of the native code so if you add any native code supported libraries or write one yourself or update any existing native libraries or codes, you need to publish the new version through the stores.
This types of services also help you to do A/B tests and alfa/beta tests.
You can find much more detailed information at CodePush website and Google.
Codepush is free and you can use react-native-code-push to use codepush service. You can use its document to have this service on your app.

Is there a way to run universal apps on Firebase Hosting?

I have recently deployed my Angular 2 application to Firebase hosting successfully and am really enjoying this set up so far, particularly on how easy it is to deploy using CI as well.
At the moment, I am looking at adding a universal server rendering support to my app, but I'm not sure if this is handled by Firebase Hosting, as it says it is static file only.
However, what made me think that this could be a potential feature that I am missing is that Firebase offers support for single page applications, hence I decided to ask.
If there isn't support for such apps, can we expect it in the future?
At the moment this is not possible. However since Angular 2, Google and Firebase go hand in hand I would say this it is just a matter of time.
In the meantime you can create a Node.js-based server, where you install Angular Universal, and have it connect to Firebase with the Firebase Node SDK.
Next, you simply communicate with that Node-backend from your Angular 2 application.
If you're using angularfire2, that will break universal either way. There's something in the package that calls "window" which doesn't exist on the server. Unless something changes with universal or angularfire this is a ways off
At the end of that video David East mentions that one can use Google Cloud Functions with Angular Universal and such: https://www.youtube.com/watch?v=R3v8EcYzf_M
The video itself is quite useful for firebase users. But the topic starts at approximately 23:30.
A different approach is to skip universal altogether and do something like this.
Rendertron is a headless chrome that can be launched. Similar to phantomjs. But universal gives speed.

Windows Store App: Dynamically load JavaScript for easier update?

Recently I have taken over a Windows Store app project written in C#/XAML and one of its requirements is,
Migrating the project to Javascript/HTML5, and by making javascript dynamically loaded from our website, we can update the code logic as often as desired without having to prompt user to download a new version of our app. The deployed app is very simple and does not require update, each time the app launch it will try to load the javascripts and contents from the web.
This requirement is from marketing and they think it is fantastic if the app can be updated in this way. I don't know if this is a good idea, or even feasible.
My questions
Give me some reasons if this is not a good idea/not feasible
If javascript can be dynamically loaded, what about html and css files?
Edit
When I asked this question, I had not heard of Cordova, the idea of hybrid app was quite new at that time. With Cordova, we can write app that runs in this way. The web content (HTML/JS/CSS) is rendered in a WebView control and can be updated from the web each time.
In short, I don't believe the app can be written in this way.
The application code is part of the appx package when the app is deployed and if you wish it to be accessible via the store, it has to pass MS's app certification checks.
This ensures that the app code is is suitable quality and ticks the appropriate security boxes etc.
I don't believe you can dynamically load application code from a remote source, otherwise you could be loading any old unverified cack and this code would not have been checked.
However, the updating mechanisms are very simple as I understand it and pushing a new version of your app code to the store will allow users to update the app at their leisure and handle the process for you.
I think the best you can get in terms of loading things dynamically would be to load a webpage remotely in your app (the webpage could be updated as you wanted). This would not allow you to run application code from the webpage, and with the webpage being remote, it would run under the 'web context' from a security perspective, so you'd not be able to use a lot of the native functionality you could run locally.
If the reason for re-developing the app in JS/HTML is to load code dynamically, I would advise against it. There are not a huge range of differences between a C# implementation and a JS implementation, so it would seem inefficient to redo all the existing work in a different language.

Categories

Resources