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
No. The server will only listen to the last set port.
It is important to understand that the server will load index.html by default. In this case you just need to make a copy of index.html (index2.html) and load /ws1 instead of /ws in index2.html.
You can then access it with: 127.0.0.1:51042/index2.html
No. The server will only listen to the last set port.
It is important to understand that the server will load index.html by default. In this case you just need to make a copy of index.html (index2.html) and load /ws1 instead of /ws in index2.html.
You can then access it with: 127.0.0.1:51042/index2.html
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 ?