Kafka was developed around 2010 at LinkedIn by a team that included Jay Kreps, Jun Rao, and Neha Narkhede. Apache Kafka is a distributed publish-subscribe messaging system in which multiple producers send data to the Kafka cluster and which in turn serves them to consumers. In the publish-subscribe model, message producers are called publishers, and one who consumes messages is called as subscribers. Kafka has a robust queue that handles a high volume of data and passes data from one point to another. Kafka prevents data loss by persisting messages on disk and replicating data in the cluster.
Topic: A stream of messages of a particular type is called a topic.
Producer: A Producer is a source of data for the Kafka cluster. It will publish messages to one or more Kafka topics.
Consumer: A Consumer consumes records from the Kafka cluster. Multiple consumers consume or read messages from topics parallelly.
Brokers: Kafka cluster may contain multiple brokers. A broker acts as a bridge between producers and consumers. A Kafka cluster may contain 10, 100, or 1,000 brokers if needed. Each Kafka broker has a unique identifier number.
Record: Messages Sent to the Kafka are in the form of records. It is a key-value pair.
ZooKeeper: It is used to track the status of Kafka cluster nodes. It also maintains information about Kafka topics, partitions, etc.
Kafka Cluster: A Kafka cluster is a system that comprises different brokers, topics, and their respective partitions. Data is written to the topic within the cluster and read by the cluster itself.
Who uses Kafka ?
A lot of companies adopted Kafka over the last few years. I will list some of the companies that use Kafka.
Netflix uses Kafka clusters together with Apache Flink for distributed video streaming processing.
Pinterest uses Kafka to handle critical events like impressions, clicks, close-ups, and repins. According to Kafka summit 2018, Pinterest has more than 2,000 brokers running on Amazon Web Services, which transports near about 800 billion messages and more than 1.2 petabytes per day, and handles more than 15 million messages per second during the peak hours.
Uber requires a lot of real-time processing. Uber collects event data from the rider and driver apps. Then they provide this data for processing to downstream consumers via Kafka.
Apache Kafka originates at LinkedIn. Linked uses Kafka for monitoring, tracking, and user activity tracking, newsfeed, and stream data.
Swiftkey uses Kafka for analytics event processing.
Apart from the above-listed companies, many companies like Adidas, Line, The New York Times, Agoda, Airbnb, Oracle, Paypal, etc use Kafka.
Why can Apache Kafka be used for video streaming?
- High throughput – Kafka handles large volume and high-velocity data with very little hardware. It also supports message throughput of thousands of messages per second.
- Low Latency – Kafka handles messages with very low latency in the range of milliseconds.
- Scalability – As Kafka is a distributed messaging system that scales up easily without any downtime. Kafka handles terabytes of data without any overhead. It can scale up to handling trillions of messages per day.
- Durability – As Kafka persists messages on disks this makes Kafka a highly durable messaging system. Also one of another reason for durability is message replication due to which messages are never lost.
Other reasons to consider Kafka for video streaming are reliability, fault tolerance, high concurrency, batch handling, real-time handling, etc.
Neova has expertise in message broker services and can help build micro-services based distributed applications that can leverage the power of a system like Kafka.
ThingsBoard is an open-source IoT platform for monitoring, data processing, visualization of data along with device management.
It supports industry-standard IoT protocols – MQTT, CoAP, and HTTP. ThingsBoard combines scalability, fault-tolerance, and performance to capture the device data for processing and monitoring. It provides its gateway server that can communicate with the attached devices.
Build around Netty Framework due to which it provides support for many protocols and applications. New Hardware protocols can be added by just adding Inbound and Outbound channel handlers for new protocols with the netty framework.
Support for provisioning and management of devices with credentials management. Custom security rules for each protocol can be applied.
2) Dashboard and Data Visualization
Built-in support for 100+ widgets components. Collect and visualize data from devices and assets in Dashboard with widgets.
Analyze incoming telemetry and trigger alarms with complex event processing. Support event storage Api to capture Telemetry metrics.
4) Rest API and RPC Support
Data workflow can be designed using Rest API and RPC Requests.
5) Push Device Data
Support to push Device data to other systems in real-time.
6) Integration with Different Message Queues
Different connectors are available to connect with different implementations of message queues. The multiple message queue implementations: Kafka, RabbitMQ, AWS SQS, Azure Service Bus, and Google Pub/Sub are supported.
7) Hybrid Database support
Stores all entities in SQL databases and telemetry data in the NoSQL database.
8) Rule Engine
In-built rule engine, to configure rules for device state and different notifications or alarms can be generated based on the telemetry of the device. Data processing rules can be changed at runtime based on the device state.
9) Deployment, Standard and Cluster mode
On-premise and cloud deployments are supported along with Standard and Cluster mode are supported
10) Alarms Management
Create and Manage alarms related to devices, assets, and customers, etc. Rule policy can be applied to raise alarms for device state changes.
Thingsboard IoT platform supports broad use cases specifically in fields of Fleet tracking, Smart Farming, Smart Metering, Smart Energy, Smart City, and Commercial Home Automation Solution.
1) Smart Farming
Smart farming is a combination of hardware (IoT) and software (SaaS) to capture the data and use data to manage all the operations on the farm, both pre and post-harvest.
2) Smart Metering
Smart Metering solutions are used to study consumption patterns.
Alarms are integrated with smart metering with rules to identify any abnormalities or energy offenders
3) Smart Energy
Smart Energy is syncing different energy producers with energy consumers to optimize energy consumption based on data points.
4) Fleet management
Different types of fleet management solutions can be derived
- Vehicle leasing, financing, maintenance, licensing, tracking, and diagnostics.
- Supply chain management.
- Driver management, Speed management, Fuel management
Thingsboard is a good choice to develop IoT Solutions. Its source code is available with Apache License.
MQTT (MQ Telemetry Transport) is a lightweight message protocol that provides telemetry information to clients with network limitations in a simple way. The protocol mainly uses a publish-subscribe communication pattern, which is mainly used for M2M(Machine to machine) communication and plays a crucial role in the Internet of things (IoT). The MQTT protocol is a great choice for wireless networks that may experience different levels of latency due to occasionally unreliable connections or bandwidth constraints.
This protocol was designed by Andy Stanford-Clark and Arlen Nipper in 1999 mainly for connecting sensors on oil pipelines with communications satellites, with an emphasis on minimum bandwidth usage.
Working of MQTT :
In the MQTT protocol, the connected devices are known as “clients,” which communicate with a server known as the “broker.” The broker handles the task of data transmission and communication between clients
Whenever a client wants to distribute particular information,it publishes that information to a particular topic, then the broker sends the information to any clients that have subscribed to that topic. Any client can be a publisher, or a subscriber, or both.
Advantages of MQTT:
- Efficient data transmission
- Quick to implement as it is a lightweight protocol
- Low network usage due to minimization of data packets
- Fast and efficient message delivery
- Uses very small amounts of power, which is good especially for the wireless devices
- Reduction of network bandwidth in communication.
Why MQTT over HTTP?
MQTT over HTTP:
|Fast as the data packet size is small||Slow as it used bigger data packet size|
|The connection is always open between broker and client||Open and close the connection every time for each request|
|Low power consumption||Higher power consumption|
|Mainly useful for sending short messages.||Mainly useful for sending lengthy messages.|
|It provides easy management for large applications.||Not easy to manage for large applications|
It is a server that handles the communication between the clients. A broker can have many clients connected to it, which can publish and subscribe all the time.
Types of MQTT Brokers:
Mosquitto is a lightweight MQTT broker written in the C language. It supports TLS and there are plugins for authorization using a database, But it has some disadvantage as:
- It does not support clustering so it is difficult in terms of scalability.
- It cannot take advantage of multi-core CPUs.
It is a very popular message broker which is written in ‘Erlang’ that supports MQTT via a plugin. It supports TLS and clustering is also fine. Authorization cannot be done using a database directly but we can create an HTTP REST wrapper over the database and that can be used for authorization. This broker supports the AMQP protocol natively but, the MQTT implementation is missing some important features such as QoS2.
It is a distributed, high-performance MQTT message broker built-in Erlang. VerneMQ can scale horizontally and vertically to support a huge number of concurrent publishers and subscribers. These subscribers can connect to any node and can also receive messages from any other node.Also, as VerneMQ is mainly written in Erlang, it is capable of working on a multi-threaded processor and also can take the benefit of multi-core processors. It is also an active community on GitHub and Docker images are also available for installation.
This is mainly an umbrella project for several MQTT implementations in different programming languages. It is an open-source MQTT client implementation and is also maintained by a huge community. Paho API comes with support with different languages and platforms like C/C++, Android, Arduino, Python, Java, and Rust. To use Paho in our IoT project we just have to import the appropriate library and begin using various functions provided by the library for our requirements. There are also various GUI tools available which include RCP application, Eclipse plugin, and Java Swing application.
MQTT Protocol is a lightweight and fast protocol for using especially in IoT. In IoT, the main concern is minimum battery and network bandwidth usage as the devices are wireless and run on battery, which can be achieved efficiently using MQTT.
The Atmosphere Framework contains client and server-side components for building Asynchronous Web Applications. Realtime client-server framework for the JVM, supporting WebSocket and cross-browser fallbacks support. The Atmosphere Framework supports all major Browsers and Servers. The Atmosphere framework is the most popular asynchronous application development framework for enterprise Java.
Atmosphere’s Java Client is called wAsync.
Why to choose Atmosphere Framework?
Based on the requirement we need a framework that supports bi-directional communication so, we have selected Atmosphere Framework. The main advantage is that it provides two-way communication between client and server over a single TCP connection. Generally, a client will send a request to the server then the server returns the response. For every request from the same client to the same server, a new connection needs to be opened. WebSocket will maintain a single connection between the client and the server. It also keeps the connection alive with all it’s clients until they disconnect.
Tomcat Configuration Steps:
Used runtime – native as atmosphere dependency for maven tool and tomcat -v9 as a server
Step 1: Download and Install Tomcat.
Step 2: Create an Environment Variable JAVA_HOME.
Step 3: Configure the Tomcat Server.
Step 4: Start Tomcat Server.
Step 5: Develop and Deploy an App.
A maven is a build tool that provides different dependencies. Here dependency means the external libraries required to build a project.
It does the following:
- Generates source code (if auto-generated code is used).
- Generates documentation from source code.
- Compiles source code.
- Packages compiled code into JAR or ZIP file.
- Installs the packaged code in a local repository, server repository, or central repository.
How to Broadcast Message from JAVA server to JAVA Client in Atmosphere Framework:
- Used Atmosphere Framework
- Used runtime-native as atmosphere dependency for maven tool
- Tomcat-v9 as a server
Long polling :
Long polling is the simplest way of having a persistent connection with a server that doesn’t use any specific protocol like WebSocket or Server Side Events. Easy to implement, and delivers messages without delays.
- A request is sent to the server.
- The server doesn’t close the connection until it has a message to send.
- When a message appears – the server responds to the request with it.
Broadcasting the messages to clients-
BroadcasterFactory.getDefault().lookup(“URL to broadcast”, true).scheduleFixedBroadcast(message, 2, TimeUnit.SECONDS);
We have used the AsyncHttpProvider library to establish a connection with the Server in async mode.
AtmosphereRequest request = atmosphereResource.getRequest();
String IncomingMessage = request.getReader().readLine();
To use Atmosphere, add the following dependency:
<dependency> <groupId>org.atmosphere</groupId> <artifactId>atmosphere-runtime</artifactId> <version>2.4.21</version> </dependency
Benefits of Atmosphere:
- Provide High Availability.
- Fault Tolerance.
The Atmosphere framework makes the development easier to build applications. The Atmosphere Framework is portable and can be deployed to any web server.
Active directory turns 20 this year!
There is a lot of talk in the community about whether AD is outdated and whether other Cloud-based directory services will replace AD. Before we jump to any conclusion, lets first understand AD in its entirety.
Active Directory (AD) is a Microsoft’s Directory Service for Windows domain networks. Active Directory handles centralized domain management and directory-based identity-related services. It is a framework on which other services such as Certificate Services, Federated Services deployed.
How does Active Directory work?
Active Directory stores data as objects. An object is an element, which may be user, group, application, or device, such as a printer. Objects are general resources –such as printers or computers — or security principals — such as users or groups.
The server which runs Active Directory Domain Service(AD DS) is called a domain controller. Authenticating and authorizing all users and computers in a Windows domain type network is done by AD DS. When a user login into a computer then the active directory checks the submitted user and password and determines whether the user is a system administrator or user. It manages and stores information, provides authentication and authorization mechanisms, and makes a framework to deploy related services: Certificate Services, Active Directory Federation Services, Lightweight Directory Services, and Rights Management Services.
Active Directory Services :
Following are the services provided by Active Directory :
1. Domain Services – stores information of members such as users, devices, their access rights, and credentials. The server running this service is called a domain controller.
2. Lightweight Directory Services – it is an implementation of LDAP protocol
3. Directory Federation Services – It is a single-sign-on (SSO) service. It may be useful when a user is registered with several web services with the same credentials. So federation services enable us to use the same credentials for different networks.
4. Certificate Services – It creates and validates public key certificates for an organization. We can use these certificates to encrypt files, emails, and network traffic.
5. Rights Management – It provides development and management tools to help organizations to protect information.
AD objects :
The individual component of an organization is called Objects in Active Directory. Active Directory stores data as objects. Following is the list of AD Objects :
- Contact: A contact object is used to store the contact of vendors or suppliers, who are not in the employ of the organization. Only the name of the person and the contact details are stored.
- User: Member of the organization in the AD is denoted by a User. The user contains information about the first name, last name, email address, and associated groups.
- Printer: This object contains information about all the printers in the network
- Computer: This object contains information about all the computers in the network
- Shared folder: This allows users to access folders from other computers on the network that have been marked as shared. Only folders, and not individual files, can be shared. If you want to share an individual file then it should be placed inside a shared folder.
- Group: It is a collection of directory objects. It contains computers, users, other groups, and other AD objects. Group has 2 types
- Distribution groups – used with emails application to send emails to the collection of users.
- Security groups– used to assign access to resources on the network
E.g For your organization, if you want to give access to certain documents to only particular departments. Network administrators will create a group containing all members of the department and provide them to access file servers containing that document.
- Organizational units (OUs): OUs help in structuring your network resources in an easy to locate manner. In OU you can place users, printers, computers, groups, and other OUs.Each domain can create its own OUs.
- Builtin: Several user accounts and group accounts are automatically created when you install an active directory for the first time.
Benefits of Active Directory :
Here are some benefits of AD:
- Central Storage– Active Directory provides a centralized storage repository for users’ files. If you save your files on the central server then other users of the domain can access them.
- Better Backup– If a user’s machine is attacked by a cyberattack, all of the files on that machine may become inaccessible. However, if they were saved to a central storage location, it would be easily recovered from central storage.
- Cut Costs– Active Directory is easy to scale up or down.
- Improved Security– As the network administrator has control over the domain in AD, they can implement new security measures when necessary. This can include installing new antivirus software onto each machine, or making sensitive documents inaccessible so they don’t fall into the wrong hands.
Cloud-based Directory Services:
There have been many new entrants in this space with the likes of Okta, JumpCloud, and others that are providing alternatives to what was the market-leading directory service. Enterprises are more distributed than ever before and applications are being deployed in Cloud making it imperative to have a directory service that can be centrally administered and managed. Microsoft with its Federated AD service in Azure (ADFS) has provided an extension of AD in the cloud. Okta, a pure SaaS service provider, is another alternative for businesses looking at a cloud based SSO solution.
Neova has expertise in Active Directory, Azure ADFS, Okta, and JumpCloud and can help organizations integrate their application with one or multiple of these directory service providers.
While applying authentication on any device or application, the first thing that comes is Password. Since the last decade. People prefer passwords for authentication. To make our password strong, mostly people use alphanumeric, special characters, bold letters, etc. Even though the user tries to apply the strongest password it has few
1. We use it in combinations of alphanumeric, characters, special characters, so they are easily forgetful
2. It has a high chance of getting hacked, pattern breached.
3. Keeping and maintaining different passwords or their patterns all over different platforms like web applications, cards, electronic gadgets is very difficult.
Considering all the above things, we have to use stronger techniques to avoid such breaches. There are so many techniques available currently to authenticate such as:
- One Time Passwords(OTP)
- Two Factor Authentications
- Multifactor Authentication(MFAs)
- Security Assertion Mark-up Language(SAML)
These techniques are used in authenticating users on different platforms such as electronic devices, web applications, bank accounts, and most enterprise levels, etc.
This is the most famous authentication method. In this technique, fingerprint and face recognition is used. For securing more critical apps like Military, Space information uses retina ID as retina is the most unique biometric ID.
This is based on what users have already saved for authentication, in technical terms it is called the “Query” with one or more samples of fingerprints, face Ids. The process of collecting these Ids is called enrollment. Verification is done with matching the sent Query with enrolled data.
- Simple to enroll and verify.
- It is much faster.
- It is available in a wide range of platforms such as Microsoft’s windows, Apple’s devices.
- There are some researches which show the biometric can be build up using high-resolution images.
- There are many Biometric systems that have accuracy issues.
One Time Passwords(OTP)
This technique is used to confirm the transaction is being done through the Authorized person who is associated with that particular account or credit card.
Step 1. The transaction is triggered after sending SMS/Email/Call to a registered communication medium.
Step 2. The Receiver receives the code on an opted communication medium.
Step 3. Receiver access to this code and uses it to authorize the transaction.
Step 4. The OTP which was unique and generated from the system expired within a few seconds, so it gets deleted from Push Messages.
Step 5. Entered OTP Automatically sends data to for verification and Transaction gets completed with valid OTP.
- It is safe from replay attacks.
- The communication modes are Email/SMS/and Calls so it’s convenient to use.
- It expires within seconds so it may go out of sync.
- Multiple wrong attempts can block your account.
Two Factor Authentication
2FA means whenever you log in to any application it will double-check if the user is authorized and a request is coming from an associated user. 2FA is mostly used to minimize the risk of getting an account hacked if the password is compromised.
- User logins to the application with Username and Password.
- If the first authentication step is cleared by the user second level of authentication enables for the user.
- The authentication user sends a unique code to the second-factor device(registered).
- The user confirmes the second level authentication by entering the code to the application.
Few methods of achieving 2FA: Authentication Apps(Like Duo), U2F devices, Passcodes(OTPs), Tokens, Calls on registered numbers, Smartcards, etc.
- It is an inexpensive method to prevent cyber attacks and helps to protect sensitive application
- Userfriendly and easy to use.
- Multiple options to use 2FA
It is the most effective way to provide advanced security and avoid brute force attacks. When any application uses MFA it creates multiple layers to authenticate the associated user who is sending a request to authenticate. Though any of the levels get breached by an attacker, the user’s data is still secure as an attacker will not have other levels.
MFA can be achieved using some combinations of listed elements below:
- Codes Generated by Authentication apps
- USB devices, Smartcards or other physical devices
- Certificates, tokens
- Biometrics like Retina, facial Id, Fingerprints
- Security Question, Images patterns
- Behavioral Patterns
Above listed elements can be categorized under three different Factors
- Knowledge-Based: Password, Pins, security question, different patterns
- Possessions: USB devices, Smartcards, Different Token on Apps
- Inheritance: Biometrics like face, voice, fingerprint, retina
The use of this MFA can be decided using AI and implemented based on different use cases for example if the user is sign in from unusual devices, network connection, locations, time of accessing the application etc..
Security Assertion Mark-up Language(SAML)
This is an open standard to exchange the Authenticated and Authorised data between Identity Providers and Service Providers. This method uses XML based markup language for security assertions. Assertions are statements that service providers use to make access control decisions.
SAML enables a single sign-on method to login to the service provider. There are two terms used in SAML ie. Service providers and Identity providers
Service providers – are those who grant access to a user in a particular application.
Identity providers – are those who send a request to SPs with enabled user rights.
- Users access the application using provided URL
- After successful identification of the user, it sends the Identity provider request for Authentication.
- Now Identity providers check for active browser session or create a new one by logging in to identity provider
- IP builds a response containing the user’s username or email address in the XML format document. This uses the X.509 Certificate and posts the user’s information to the service provider.
- Service provider checks for the identity provider as it already has a certificate fingerprint; retrieves the authentication response and validates using certificate fingerprint.
- When the identification of the user is established, the application is accessible to the user.
Advantage of SAML is that user don’t need to log in to the application using credentials and the same credentials can be reused for log in to other service providers
Conclusion:Attackers are busy finding ways to breach the security of applications and devices but Users are even Smarter, they are using different Authentication techniques to protect data.
This is an IEEE paper where Multimodal biometric approaches are explained in detail like facial detection, Fingerprint scanning, Voice recognition.
What is Kissmetrics?
Kissmetrics is a web analytics tool that provides key insights and user interaction on the website. It gives a clear analysis of user activities on your website and collects the data of every visitor which helps to turn your insights into sales.
- It is a real-time data monitoring tool.
- The implementation of email campaigns helps to increase engagement and sales. Not only delivers automated emails to customers but also creates different segments of customers to send targeted emails. In addition, using insights it is possible to understand customer behavior and can surface key insights that help to make better decisions. It can be easily integrated with third-party applications.
- One of the important features of the Kissmetrics analytical tool is event tracking. It tracks the important events happening in the application.
- Campaign Management feature allows a user to analyze and track marketing campaigns.
- Conversion Tracking feature can track customer conversion rate.
- Goal tracking allows users to track progress which can help the user to reach business objectives.
- User interaction tracking identifies and tracks the visitors’ interaction on the website.
- Kissmetrics tracks the time that a visitor spends on the website.
- Report generation is one of the key features of Kissmetrics, It gathers data and generates reports.
- Kissmetrics allows analysis and tracks more than one website.
- Kissmetrics has a notifications feature that alerts the user when predefined criteria are met.
- Heatmap is one more feature in Kissmetrics which shows where users have clicked on a page.
- Data export feature is available.
- Unlimited Group Contact Lists.
- Don’t have to go around searching for figures. It has a powerful dashboard.
- Easy to use. Simply sign-up for an account and can customize accordingly. Add a java snippet under <head> tag of the source code of the website for tracking.
- High learning curve.
- UI – the user interface is not very user friendly.
- Dashboard options are limited.
- Limited integration capabilities.
- It takes more time to implement especially if you have a complicated website with too many different events.
- It is expensive. The cost is really not affordable for a small business or startup.
Kissmetrics offers multiple packages with various features in the range of $199 – $499 per month. You can check pricing and packages here.
Custom Solution for Tracking User Activities and Events:
Pixel tracking method is used to track events and user actions. Adding the tracking pixel can be done by an HTML code, which contains an external link to the server. When the user visits a website, this code is processed by their browser, which follows that external link. This method allows one to track visitor’s information. The following data is tracked using pixel:
- Operating System and device type.
- Time spent on the website.
- Browser Information.
- Ip address.
- Location of the user.
- Activities on the site during a session.
Kissmetrics is one of the best analytical tools in the market that helps saas product companies track conversions. More than 6523 companies are using this tool. Big Brands like eBay, Accenture, and WordPress are few examples who use the Kissmetrics tool.
We have an expert team of engineers who can help you to configure Kissmetrics and provide a custom analytical solution. Please feel free to connect in case of any queries.
Mobile app security has become evenly important in today’s world. A rupture in mobile security can give hackers access to the user’s personal life in real-time, also disclose data like their location, personal & banking related information, and much more.
App Developers should aim to create applications that meet all user expectations regarding security & safety. All the below approaches and methods enable successful application development, making it difficult for attackers to get access to sensitive data.
Let’s find out some best practices for mobile security
To achieve data security, Encryption is the most operative way. The sensitive data in all mobile applications developed should be encrypted with complex algorithms such as RSA, AES, and DES.
Server Side Security
While developing mobile applications mobile backend security is also important. Below are the few things you need to know to protect your mobile sensitive data:
- Use HTTPS back end for all API calls as this protocol is designed for secure communications over computer networks and the internet.
- API call limits on the server-side.
- Authentication should expire after a reasonable amount of time.
Protected local storage
Local storage: where Applications media files, settings files, and other files are stored.
In protected local storage, data is encrypted with the help of a key. And to read these encrypted files(video, text, audio, etc.) we have to decipher it by a key (eg.password) which converts data back into the plain text.
Code obfuscation is the intentional act of creating a source code or machine code that is difficult for hackers to understand.
Obfuscators are used to automatically convert programming code into a format that cannot be understood by humans.
How does it work?
- It encrypts some or the entire code.
- It removes metadata which may reveal information about the libraries or APIs used.
- It renames classes and variables so they cannot be guessed
In iOS, obfuscation technique is not generally used as its libraries are closed, whereas Android has open-source libraries so it becomes necessary for android developers to obfuscate code.
A device’s cache saves data for all apps and websites that have been used on the device. If the cache is not encrypted, hackers can easily access data stored in it. Clearing the cache every now and then is necessary to free up some space on your phone or tablet.
One of the best ways to handle sessions more securely is to use tokens instead of device identifiers as it can be revoked whenever needed. Another option is to consider session expiration while developing an application.
Here in Neova, we develop applications that satisfy the needs of the user and focus their efforts on the security aspect as well.
For more information about making your application more safe & secure, consult the following resources.