Baserow Socket
Hello Everyone, I am here again with my new extension that is Baserow Socket. This extension helps you to use Baserow websocket API for realtime collaborations in your apps. It is same as firebase real-time database. This extension notify you all changes that are making in your database. There are some specific events for specific changes. You can receive all update of a table after subscribing it.
Let see its blocks and their documentation.
All Blocks
Property
URL Designer property for setting your hosting url.
Documentation
This event raises when the web socket connected.
This event raises when web socket disconnected.
This event raises when any error occurred.
This event raises when you subscribe any table and it success.
This event raises when a new row is created in your table.
This event raises when any row is updated in your database. This block will return the id of that row.
This event raises when a row is deleted from your table. Return the row id that is deleted.
This event raises when any changed made in your database like above events. This event return the change type in type
parameter like row_deleted
or row_created
. You can look here for all return types. This event would not raise when the row is deleted, updated or created as there are already specific events for these changes.
This event raises when the token is generated.
This block generate the token from given email and password. Make sure the token will be expired in 60 minute. You will need to generate a new one later. Your web socket will be disconnected automatically after the token expires.
this block connect the web socket with token.
this block disconnect the web socket.
This block subscribe the table for given table id. You will only receive updates related to this table. For multiple table you would need to use multiple component.
Property for getting and setting the URL of the API. If you use hosted version of baserow then you could simply set your URL here.
Usage
Let see How to use the extension. We will do some couples of thing to test it.
Firstly to work with baserow socket we must have to generate token to connect it. So Simply generate it with this block.
After token generated , Connect the web socket.
If all things right, then the Connected event will be triggered with a response. After connection, we would have to subscribe a table which we want to get update of.
We have now subscribed to our table. Now we can receive all updates of this table.
So Let test it with some changes.
Row Created
{
"type": "row_created",
"table_id": 26026,
"row": {
"id": 63,
"order": "25.00000000000000000000",
"field_136918": ""
},
"metadata": {},
"before_row_id": null
}
I received the above response when I added an empty row to my database
Row Updated
{
"type": "row_updated",
"table_id": 26026,
"row_before_update": {
"id": 63,
"order": "25.00000000000000000000",
"field_136918": ""
},
"row": {
"id": 63,
"order": "25.00000000000000000000",
"field_136918": "Sumit Kumar"
},
"metadata": {}
}
The above response is received from RowUpdated block when I updated the above created empty row. The response also contains previous data that has updated.
Row Deleted
{
"type": "row_deleted",
"table_id": 26026,
"row_id": 63,
"row": {
"id": 63,
"order": "25.00000000000000000000",
"field_136918": "Sumit Kumar"
}
}
This one when I deleted the row. There are three specific events block available for three specific actions. Other changes can be received through Data Changed block.
The speed is very fast (== firebase). I receive the response very quickly.
Download
Donate
If you liked my work and want to donate then:
Credit
Thanks @Shreyash for the super power full Rush .
Thanks @vknow360 for helping me .
Worked very hard for this long extension so like the extension if you like it
Suggestion and issue are welcome
Thanks you
Sumit​