B4J Question [ABMaterial] B4JS - More then 1 web app on 1 vps

mangyun

Member
Hello all,

Is it possible to host more than 1 b4j webapps - with different port on 1 server/vps ?

I have 1 running app(port 8899) (abmaterial) on a vps, when I tried to run another one(different app - also abmaterial, port 10002) on the same vps, it was running. I can connect to both.
but when I logged in on the second app, I got logged out from the first app, vice versa.

On a bigger picture, will they (both apps) interfere each other while they are running, variables etc...

thank you.
 
Solution
thanks for the reply
This is because you are connecting to 2 different webapps but using the same domain/IP. The ws session is assigned to a domain. You need to put each ABMaterial webapp on a separate domain.
Here's a solution on how to do it:
https://www.b4x.com/android/forum/t...-abmaterial-servers-on-one-ip.113015/#content

i found a solution for my case. changing the appname worked (forgot to change it when copy pasting basic project files from the first one.)
ABMShared
B4X:
Public AppName As String = "xxx"

so with 2 different apps, different port, 1 vps.
same client(1 computer, 1 browser).
the AppName need to be different.

i guess this one has something to do with it...

mangyun

Member
Hello all,

Is it possible to host more than 1 b4j webapps - with different port on 1 server/vps ?

I have 1 running app(port 8899) (abmaterial) on a vps, when I tried to run another one(different app - also abmaterial, port 10002) on the same vps, it was running. I can connect to both.
but when I logged in on the second app, I got logged out from the first app, vice versa.

On a bigger picture, will they (both apps) interfere each other while they are running, variables etc...

thank you.
it turn out the problem lies with the client/browser.
1 pc, 1 browser with 1 tab connect to app 1, 1 tab connect to app 2 >>>> problem.
1 pc, different browser >>>> no problem.

new question, is it possible to access 2 different webapp from 1 browser safely?
checking the log, the session got mixed up.
 
Upvote 0

mangyun

Member
thanks for the reply
This is because you are connecting to 2 different webapps but using the same domain/IP. The ws session is assigned to a domain. You need to put each ABMaterial webapp on a separate domain.
Here's a solution on how to do it:
https://www.b4x.com/android/forum/t...-abmaterial-servers-on-one-ip.113015/#content

i found a solution for my case. changing the appname worked (forgot to change it when copy pasting basic project files from the first one.)
ABMShared
B4X:
Public AppName As String = "xxx"

so with 2 different apps, different port, 1 vps.
same client(1 computer, 1 browser).
the AppName need to be different.

i guess this one has something to do with it.
B4X:
srvr.AddWebSocket("/ws/" & [B]AppName[/B], "ABMApplication")
 
Upvote 0
Solution
Top