B4J Question b4j server and/or websockets

moster67

Expert
Licensed User
Longtime User
Sorry for a stupid question but I am not very familiar with web-development...
I have no problems running a b4j-server using handles with response and requests etc. I have done some of this in the office.
However, now as a personal project, I would like to use an existing web-theme and populate certain sections with some dynamic data (such as tables, blog-lists etc) retrieved from my database. The idea is that I will replace the sections concerned in the web-theme with some place-holders where my retrived data will be populated.
Which is the procedure to do this? Shall I use websockets?
Thanks.
 

alwaysbusy

Expert
Licensed User
Longtime User
If you don't require bi-directional communication (e.g. the server will update something with a timer, without the browser doing a request), I don't see the need to use websockets.

You can do the replace of the place-holders in the handler that receives the request (your handler returns 'static' content, but this 'static' content can come from your database).

If however your web-theme does require to run some javascript (e.g. a special type of button you inject in the page that requires to run some initialization javascript), websockets are great. You keep a connection line to the browser open and both the server and browser can talk with each other using javascript.
 
Upvote 0
Top