B4J Question Extended functionality for Custom WebSocket Push Framework

vfafou

Well-Known Member
Licensed User
Longtime User
Hello!
I have implemented a taxi route dispatching solution with Custom WebSocket Push Framework.
It's working nicely but I'm looking for improving further its performance.
I've made a thought to create a class into the websocket server application, running for every route a new thread in order to control the dispatching for the routes.
Is it possible to run this class of the route object in multiple threads?
Every route object will have all the properties (flags,list of drivers interested in,etc.) needed to control the dispatching.
30 seconds after broadcasting of the route, I have to check for the nearest driver who claimed the route, so it will be needed a timer for every route thread (unless there is a better idea than timer)...
Is all the above possible?

Thank you in advance!
 
Last edited:

vfafou

Well-Known Member
Licensed User
Longtime User
Hello Erel!
Thank you for your reply!
OK with CallSubDelayed, but when I call a sub from a code module, I call it directly from the thread that owns the websocket, for example:
B4X:
a = Utils.IfNull(b,"40")
This code is executed by the current or by the main thread?
Suppose we have 5 route threads. Is it possible to have one Timer for each thread?
Each route object will have a list of nearest to the customer point drivers. Every time a driver send me route acceptance, the list item referred to this driver will be updated with the accepted flag on. If I have 3 concurrent acceptances, is it safe to change the list or it will cause problems?
 
Upvote 0
Top