XSockets is such a product. In this post I have build two map clients, one in web and one on WPF. Both map clients are built on top of Bing Maps. The scenario is we have a fleet with n number of vehicles that should be able to see each other in real time.
- To do that I emulate the vehicles and its positions in route files.
- The server reads the route files and send each vehicles location to the subscribers
- The client gets the position and updates the location of the map
My friend Uffe Björklund help me with the server side. It basically consist of three entities. One class that is responsible to spin up threads for each route. One class that defines the route and one struct that holds the message.
I am surprised of how easy it was to wire up the client side. With just three lines of code, we are good to go, with a subject subscription! The map client to handle the actual real time, with plotting, create new, update is just around 40 lines of code!
A screen shot from the web client.
A screen shot from the web client.
Why XSockets
The choice of XSockets is this demo was not only becasue it was easy to implement. It is also a choice for the future when the samples for realtime GIS will be more advanced.
That's when XSockets will shine with the abilities missing in other frameworks:
- Targeting clients based on state with lambda expressions
- Quality Of Service
- Retained messages
- Auto-reconnect in combination with QoS and Retained messages (important for mobile clients)
Code
You can get the code from GitHub.
Inga kommentarer:
Skicka en kommentar