B4J Question Websockets

Yvon Steinthal

Active Member
Licensed User
Hello all,

I have a question regarding a webserver that would send data to a specific local ip on the user's wifi.
First i dont know if its possible or simple.

I am using an android Tablet that is listening to incoming connections (using B4A Network, Async... provided by this forum)

In other words i want to be able to send data from my computer to my android tablet but by using a webpage instead of the already great B4J example provided by Erel. I want my users to be able to upload to their tablets from their computer without having to install any program.

Any thoughts or opinions on that? Where should i start?

Thanks.

Y.
 

lip

Active Member
Licensed User
Longtime User
If I'm understanding you correctly (forgive me if not):-

When devices connect to your websocket server they can call an 'Identify' function on the server with a unique parameter (such as the user's login or the tablet's identity or the local IP address. The server then has a Process Global Map which maps the Identity to the Websocket connection.

Your webpage could include the same login or could list the available IP addresses from the map.

You can now send a message or file from the webpage to the server including the identifier. The websocket server uses the identifier and the map to forward the message to the appropriate websocket connection to the tablet.
 
Upvote 0

lip

Active Member
Licensed User
Longtime User
The main concept to understand is the Process Global Map of Websockets:

The Key is any unique identifier that you choose to identify a physical device, such as its mac address. or username, or Postcode.
The Value is the actual websocket object. This allows you to find the appropriate websocket object to get to the physical device.

To populate the map, the Client calls a Sub on the server (with its unique identify as a parameter) when the Websocket Connection succeeds. The server sub Puts this entry into the Global Map.
 
Upvote 0
Top