B4J Question web apps

elitevenkat

Active Member
Licensed User
Longtime User
i found the following thread on searching webapps keyword. It is very useful and straight forward concept.

https://www.b4x.com/android/forum/threads/webapp-example-task-manager-using-websockets-sqlite.39884/

my question is: if i want to access say 4 tables in a database using the above concept, will the below coding work or is there any other way to achieve the result ?
B4X:
    ' Init the webserver
    srvr.Initialize("srvr")
    ' Add the websockets
    ' TaskMgr Handler = TaskMgr.bas 
    srvr.AddWebSocket("/ws", "TaskMgr")
    srvr.Port = 51042

    srvr.AddWebSocket("/ws1", "tt1")  ( tt1 is one more class module for the next web client form)
    srvr.Port = 51043

    srvr.Start
    '
    StartMessageLoop
 

elitevenkat

Active Member
Licensed User
Longtime User

Ok Erel, let me if i understood t correctly:

in server project i have to open a socket for each client page (index...html)
B4X:
srvr.AddWebSocket("/ws1", "tt1") ( tt1 is one more class module for the next web client form)
write the relevant code in the tt1 class module

in the html page i need to change the following line

    // Connect to the server and fetch the data = the handler ToDoMain.bas is called
       b4j_connect("/ws"); TO   b4j_connect("/ws1");

[code/]

did i get it ?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…