B4J Question Web Socket Server

vfafou

Well-Known Member
Licensed User
Longtime User
Hello!
I would like to ask you if it will work if I open 2 websocket servers into the same application, with different ports.

I mean:
B4X:
srvr.AddWebSocket("/wsserver/listen","PushB4A")
srvr.Port = 56430
srvr.Start

srvrB.AddWebSocket("/wsserver/listen","PushB4A")
srvrB.Port = 56440
srvrB.Start

I need to do it, in case of internet line interrupt.
I have a backup line on my server and I want to reconnect the devices there!

I've tried to do it to my test environment and works, but I hesitate to do it to the production.

Thank you in advance.
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
It will probably work fine. However I don't think that it will do any good.

If the device cannot connect to the first port then it will also won't connect to the second one.

If there are problems with the server itself then you can run two server instances with different ports. Make the port configurable and run two instances.
 
Upvote 0

vfafou

Well-Known Member
Licensed User
Longtime User
Hello Erel!
There is a seldom state that although the main internet line is leased, it is possible to go down for example because of maintenance reasons from the vendor.
My system has to be up 24/7 and this is the reason I need a backup line...
The second line is permanently connected to the server, so I could autoconnect the devices to this line.
Thank you for your help!
 
Upvote 0
Top