Changing database records if no request fired - mysql

I am working on an IoT project. The device will request its state through a webservice/socket. I need to change a device's record if I got no request to get device's data within time slot.
How can I do that?

Related

Apple Wallet Event Pass - Device registration

We created a wallet pass and sent the wallet pass invitation email to end-users. However, there was an issue with the back-end APIs which prevented the Apple pass from automatically calling the device registration API.
The question I have is, do we need to re-inform all user to reinstall the Pass, or will the Pass automatically try re-registering by calling the device API.
Thank you.
The way you have worded your question possibly describes an impossible situation. A valid pass will always attempt to register. You state that your API was the issue, but an issue with a web service implementation would not prevent devices attempting to call it.
If the pass.json contains a valid https webServiceURL an authenticationToken, it will call the device registration endpoint after it has been added to the user's wallet. If the device does not get a 201 or 200 response, it will continue to retry, progressively backing off from every few seconds, to every few days for a period of around 2 weeks.
Therefore, if your pass.json contained the correct information; assuming that the issue was with your device registration endpoint and assuming that you picked up and addressed the issue quickly, then you should see device registrations coming in without having to do anything.
If it took longer than a couple of weeks or if you want to accelerate the process, you could ask your users to toggle the Automatic Notifications setting on the back of the pass. This will force the device to attempt a re-registration.
If however, the pass does not contain a webServiceURL, or if the webServiceURL was incorrect, then the device will not call back, or will call the incorrect endpoint. In this case, the only option is to have your users reinstall the pass. In this case, it is not your API that is causing the problem, but your passes.

AngularJS + Ionic: Checking if new Entry in Database, if yes: Push notification

I am working on an application with ionic and angularjs. I would like, that the app checks automatically in the background, if new database entries are available. If yes, it should send a notification. My question: How can I check in the background continiously, if there is an database update?
And Question #2: If there is no entry in the database, it should throw you out of the actual page.
Background: I am working on an live-survey app for events, with which you can interact with the show on the stage. If a question is activated for the people, you should get a notification.
1 - for continuously checks you should use cron job from your server side and based on it you can send your notifications
2- if there is no entries you can send push notification with any flag in its payload and check on it in the mobile app then execute the desired behavior.

How to prevent user log in from two devices

I am developing mobile application in ionic 2. I want to design mechanism when user log in my website i must log out from my mobile application at the same time if user logged in mobile application then website must be log out. I am using same database for mobile and website. I am using jsonwebtoken for my mobile authentication. what is the best way to implement this mechanism in my ionic 2 application.
you will need to create a session table that will store the session details and will also store the unique ID and status that will be used to identify these sessions and tell us weather it is active or not. This id will be used as a reference to validate session for different devices, once the user logs in you will query into this table and check whether any existing session is there or not. If it is there change the status to false.
In the UI you will use setinterval to request for this session at regular time it can be 10 seconds or anything based on your requirement then inside setinterval make a call to backend that will be checking this session, if this session status is false then logout.

Why is a Push Engine Required

Our Architecture is using a Push Engine to send data to the browser ,
Could anybody please tell me what is the use of Push Engine ??
( Why is it required , as the same thing can be achivied using a normal AJAX programming )\
Please guide me .
let's say your visiting a website, and the website is updated continuously. Your browser needs to keep updating the data that you're viewing, meaning that the browser needs to keep communicating with the server, and get the updates.
you can use ajax to make requests every few seconds, each time fetch more data from the server. Problem is - you need to make a lot of ajax calls, and you open a connection (a socket) for each, and eventually, it is a very slow process. if the interval between the requests is large, you will have a delay between the updates on the servers, and the updates in your browser.
to solve that, we can manipulate the HTTP calls - keep the request (the connection) open, and continuously send data. that way, when the server wants to send something to the client (browser), there's an open connection, and it doesn't need to way for the next ajax call by the browser.
HTTP servers have a timeout on the requests, so just before request times out, browser will close it and make a new one.
another (better) method is using XMPP protocal, which is used in chats like facebook's and msn.
AJAX is a pull method - it requires the client to connect to the server. If you have some information that you want to display live - for example a live score in a football game - the AJAX call has to be made at regular intervals - even when there is no data waiting on the server. A Push Engine is the reverse - the client and server maintain a connection and the server pushes data when there is data to be sent.

What is the SyncState lifetime and max size in Exchange Web Services Manage API?

I'm using the EWS managed API to get the data from some resource calendars. Every run of my application I get all the items in the calendar, even if I have saved the SyncState used from the last run. Is there a way to only get the updates? It seems that the SyncState is tied to the current connection or something.
Secondly, if one can use the SyncState string from a previous run, what is the maximum size of this string? I would like to store it in a DB and need to know the required record size.
Thanks.
Yes, you can store the SyncState and use it in future requests. Every time you make a call to get the newest items from your calendars you will get a new SyncState object which needs to be stored.
When you create your SyncFolderItemsType you can add your stored syncstate to it before execution. Look at the link and it should give you an idea.
I am not sure about the maximum size of the SyncState string though.
Thanks