B4J Tutorial Pocketbase CRUD REST API & SSE with PostMan and then HttpUtils

Hi

CRUD Examples Attached

PocketBase
is an open source backend consisting of embedded database (SQLite) with realtime subscriptions, built-in users management, convenient dashboard UI and simple REST-ish API.



It runs on Linux, Windows and Mac, You can get it here, https://pocketbase.io/

We will look at each offering using HTTPUtils, thus covering the REST API both with postman & b4x.

Here we go.

PS: Do not forget to start the server

1668731707741.png
 

Attachments

  • PocketBase.zip
    6.9 KB · Views: 262
Last edited:

amorosik

Expert
Licensed User
We may not yet fully realize the implications of this technology
But even at first sight it is really very effective
Many thanks for generously sharing your technical skills
 

giannimaione

Well-Known Member
Licensed User
Longtime User
hello,

your examples attached work fine,

i click on "Connect2SSE" and "Subscribe 2 SSE",
and after update / create (from browser admin) a record, app response with:
B4X:
Private Sub pb_SSE (Action As String, Response As Map)
    Log("pb_SSE")
    Log(Action)
    Log(Response)
End Sub
OK! PERFECT!

but after ~ 60 second it will response
B4X:
Private Sub pb_Disconnected (Status As Boolean)
    Log("pb_Disconnected")
    txtOutput.Text = $"Disconnected: ${Status}"$
End Sub

from documentation of pocketbase
Establishes a new SSE connection and immediately sends a PB_CONNECT SSE event with the created client ID.

If the connected client doesn't receive any new messages for 5 minutes, the server will send a disconnect signal (this is to prevent forgotten/leaked connections). The connection will be automatically reestablished if the client is still active (eg. the browser tab is still open).

I get disconnected after 60 seconds, but not after 5 minutes
why?
 
Last edited:
Top