Sorry i entered late into the conversation.Your opinion (or your experience?)
How should it be organized, if the input server-balancer is not prepared on time in advance ?You may want to scale horizontally, more servers
The clients will be Android and iOS, so at least for now no html, no html pages.Server has to be as stateless as possible.
- Websockets are stateful but http calls are stateless
- Keep the Websocket as slim as possible
- One Websocket per user is enough
- Once a message goes in, en-route to where it belongs
- Say you will have classes for each game
- Don't refresh the page everytime the user navigates
- @aeric already has a couple of examples with HTMX
- HTMX WS is worth your while.
They way Jserver is built, its better to start dividing your server than deploying the same server multiple times and loadbalancing them. what i mean is Specialized servers.How should it be organized, if the input server-balancer is not prepared on time in advance ?
Happy to answer any related question.It's theoretical questions, maybe to be moved into a new thread...
Http calls are better, IMHO, because with WS you need to juggle desconections and these are pretty common on Mobiles.The clients will be Android and iOS, so at least for now no html, no html pages.
Of course it does, what i mean is, keep your Websocket class as bare as possible, use it just to en-route to the working class.The slim websocket... does not depend on me.
its better"Concept" always had:
srvr.AddWebSocket("/Test", "wshUser")
bad idea, one of the main concerns with WS is to know WHERE the user is, with this method, they will be everywhere"New concept", recent:
srvr.AddWebSocket("/Test/Chess", "wshChessPlayer")
srvr.AddWebSocket("/Test/BlackJack", "wshBlackJackPlayer")
this is part of your business logic. Consider then that in order to grow your business you need information and DB will be your only source.As for database access, I think I'll do it as little as possible; I'll have thread safe maps for rooms and players but I won't write to DB everything that happens in the rooms, every move of the players, the game, player and room state. I would save the player's state to DB in case of disconnection (but I will have to foresee a way to delete this if the user will not reconnect soon; probably I will do it at the end of the game).
Never wait until you have a perfect product to launch, you will never launch it! make it as bug free as possible launch and iterate from there.The problem is that I developed (a long time ago) client and server for a single game (imperfect but working).
how would you know if you dont launch it?Only later did I think that a single game would be unattractive and I thought of developing a client-server base to manage multiple turn-based multiplayer games (a base that I will use for myself that I will give away on B4X, for a minimum donation of €800)
Yes but I have little experience in developing web pages.Http calls are better, IMHO, because with WS you need to juggle desconections and these are pretty common on Mobiles.
As with everything, there are pros and cons.bad idea, one of the main concerns with WS is to know WHERE the user is, with this method, they will be everywhere
I saw this in many Other Szenarios,too.I think that what @Sandman is trying to say is:
If you pretend to prevent all the possible problems and scenarios that some code can create you will end up like the dog spinning around trying to bite his own tail.
Of course every good developer will try to think to the majority of problems and prevent them, but nailing the perfection at the first shot it's nearly impossible.
At a certain point you should publish your creation and then wait for the users feedback.
On that you will improve, add, correct.
Seeking the perfection (only to your eyes at that moment) could lead you to an eternal do/undo/redo cycle.
Http calls with httpjob on b4xpages, I didn't mean to change your project to webYes but I have little experience in developing web pages.
Developing a B4XPages app and a B4J server is much "simpler" for me.
However, I think that for a turn-based game, which is NOT chess, but "immediate" games, websocket is better.Http calls with httpjob on b4xpages, I didn't mean to change your project to web
I don't remember all the problems I had, since the last time I worked on the project was 3 years ago, but I remember that there were many.Not sure which part you stuck with.
I may start with a very simple game.
Example a game where 2 player guessing a random number.
Once the turn base logic works, it can apply to all the turn base games.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?