Other B4X Push Server

moster67

Expert
Licensed User
Longtime User
OMG! I totally forgot about the other two files....



Thanks Erel! Now everything is OK....
 

tufanv

Expert
Licensed User
Longtime User
I want to run 2 different servers on same vps can i use port 51045 for the second one ?
 

shashkiranr

Active Member
Licensed User
Longtime User
Hi All,

I have few doubts,

1. Does the server send messages to google cloud and google cloud send messages to all the registered android devices? If this is true then should the api key obtained from google cloud messaging be server key?

2. How is the flow of messages? from client to server or vice versa.

Kindly let me know.

Best,
SK
 

shashkiranr

Active Member
Licensed User
Longtime User
Thank you for your reply Erel. One question.

If the server has to send specific messages to only a few selected devices then can that be achieved with this? - I got this - I can send a selected list of devices to GCM

To test the sever side, should i run the jar in a vps ? or can i run in local host ? or is there any other way test the server side component.


Best,
SK
 
Last edited:

moster67

Expert
Licensed User
Longtime User
Finally I got silent and normal push notifications up and running in a rather reliable way. Now I need to automate certain web calls (send servlets) and execute them according to a schedule. I believe this can be done in 2 ways on the server:

1) Write a script using Cron and/or CronTab to schedule and execute the send servlets (using wget http://localhost:portnumber/....)
2) Add another module in the PushServer using a timer and a query to schedule/execute the send servlets

I would prefer the 2nd option but my timer would probably need to trigger every 60-90 seconds. Would this be too often for the PushServer taking into account it will also likely be receiving data while sending out data?

Any comments/ideas?
 

somed3v3loper

Well-Known Member
Licensed User
Longtime User
My device never receives GCM push .
Registration is successful and B4J server logs and print to html page that message have been sent to device or devices but B4A client does receives nothing .
I even tried the example and changed server ip and sender Id but I never got it working .
Please help
 

moster67

Expert
Licensed User
Longtime User
I read the notes about Apple's feedback-server that it is not reliable in sandbox mode.
In order to check if at least the iOSfeedback code-module is trying to pull data from Apple's server, I put a log statement in the "timer1_tick sub" but it seems it is never executed (should do it every one hour). This should work in sandbox-mode too I guess.
In Main the feedback service is started using "iOSFeedback.Start" and it runs the first time (when server starts) but thereafter the timer does not seem to trigger itself....
Is it working for someone else?

I am also trying this because I want to use the iOSfeedback code-module as an example for creating my own service that sends out notifications automatically (based on a schedule).
 
Last edited:

moster67

Expert
Licensed User
Longtime User
For some reason the timer was disabled in sock_Connected event. Remove that line.
Thanks for sorting it out although I admit I should have seen that line myself.....
 

moster67

Expert
Licensed User
Longtime User
Now the iOSFeedback code module runs with its timer-event - however I noted the following exceptions:


It seems that these exceptions originate from the execution of the iOSFeedback module. After, the server restarts automatically. I note that tokens are received and that GET and POST requests continue to work - the only thing that does not work is the sending out of the notifications. Restarting the server, the sending out of the notification starts working again.

Is this problem related to the problems you mentioned in the first post of this thread when using Apple's Sandbox feedback server (i.e. maybe it is returning "bad" data or tokens not available in my DB and which make the server crash somehow)?

I will leave the server running during the night and see if I get the same exceptions again when the timer in the iOSFeedback module triggers again (maybe it depends also if feedback data is available or not). Will report back tomorrow.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
The problem was in Sub SubListToArray. The parameter name was the same as a sub name so it called the sub instead of getting the parameter value.
It should have been a compiler error (it will be in the next version of the IDE).

I've uploaded a new version (0.97) to the first post. It fixes this issue.
I cannot test the feedback here as it doesn't return anything. Please try it and post any issue you encounter.
 

moster67

Expert
Licensed User
Longtime User
OK, I will test later.
I took note of the change of Sub SubListToArray. I was thinking of correcting only this sub in my Pushserver-sources (which I have modified compared to your original version) but I also noted that the OKhttp-library is now required. Did you change any other things? If you don't remember, don't worry - I will use your latest source-code and apply my changes...
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…