Android Tutorial Custom WebSocket Based Push Framework

iCAB

Well-Known Member
Licensed User
Longtime User
Honestly, I don't see any issue related to the load. In fact I modified the code to work as a message relay without logging any messages to the database. I believe the server code should be able to take 10 times (if not more ) the load that we are putting on it easily.
My concern, is that one of the underlying components could be failing somehow.
What puzzles me is the fact that it was triggered in the Ping event but it wasn't caught by the catch block.
Please provide me as much info as possible, so I can get to the bottom of it before losing the client
 

iCAB

Well-Known Member
Licensed User
Longtime User
I would try the original example, this would exclude configuration problems (if it worked, of course).

Honestly I do see your point, however at this stage it will be close to impossible to do that, as the B4J server is acting as a middleware between the units in the field and another host on the local network.
All what I am hoping for at this stage is to catch the error using, Try catch. If I can do that, I would at least be able to identify it and possibly use some code to restart or something along these lines until we know the exact cause.
 

vfafou

Well-Known Member
Licensed User
Longtime User
Hello!
Does anyone know if it's a good idea to move the code of the PushService to Starter service module?

Thank you in advance!
 

IslandMedic

Member
Licensed User
Longtime User
If you need MySql it's better to write a WEBSERVICE, so you don't have to care about connections(and you DB passwords are not published!) I have written some in PHP and vb.net. If you need them send only have to ask!
I would love to review your Web service code to access mysql. Trying to figure out the best way...

Thanks

Brad
 

vfafou

Well-Known Member
Licensed User
Longtime User
Hello!
I've noticed that if the internet connection is lost, then the server side does not reconnect to the internet.
Is there any action I have to take, in order to reconnect the server app to the internet?

Thank you in advance!
 

vfafou

Well-Known Member
Licensed User
Longtime User
Hello Erel!
I've finally found that all dysfunctions are caused by the database (MariaDB 10.1). On Device_Ping, I update every 10 seconds the table with the positions of the devices. So, if I have 300 concurrent updates then the table locks are much more and the application is running very slowly!
I have to find a better solution than storing locations to a DB table.
What is the best practice in order to find the closest to a point devices?
Storing coordinates to a map/list?
If yes, is there any fast and reliable way to find from map/list the closest devices?
Thank you in advance!
 

somed3v3loper

Well-Known Member
Licensed User
Longtime User
How reliable is this solution in providing real time push messages ?

Can it be a perfect alternative to GCM ?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Can it be a perfect alternative to GCM ?
It depends on your requirements. For the custom push framework to work properly the process must be running, unlike GCM which is handled by the OS and only when a new message arrives it wakes up the process.

This solution is less suitable for a public consumer app.
 

somed3v3loper

Well-Known Member
Licensed User
Longtime User
Is it possible to develop it so it can work like GCM ?
I think some companies have developed their own push messages .

Can we for example have some internet intent that wakes service when push is sent ?

Thanks in advance
 

vfafou

Well-Known Member
Licensed User
Longtime User
Is it possible to develop it so it can work like GCM ?
I think some companies have developed their own push messages .

Can we for example have some internet intent that wakes service when push is sent ?

Thanks in advance

Hello, somed3v3loper.
I would like to ask you what kind of application do you want to make?
I have made a taxi fleet management application, with ~450-500 concurrent tablets connected, on an old HP proliant G6 1U server with 4core XEON CPU and 16GB RAM with MariaDB 10.1 database. After optimizing the database instance, whole system is working perfectly.
 

somed3v3loper

Well-Known Member
Licensed User
Longtime User
No. This is technically not possible.

The only way to send push messages to Android devices without running a process all the time is with GCM.

But parse.com for example has a push messages service how did they create it ?
 

somed3v3loper

Well-Known Member
Licensed User
Longtime User

Hi vfafou,

I am thinking of developing real time chat.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…